Build a series of queries into a transaction. More...
#include <asql.hpp>
Classes | |
struct | Item |
Ties query objects to their statements. More... | |
Public Types | |
typedef std::vector< Item > ::iterator | iterator |
Public Member Functions | |
void | push (Query &query, T &statement) |
Add a query to the transaction. | |
void | clear () |
Remove all queries from the transaction. | |
iterator | begin () |
Return a starting iterator. | |
iterator | end () |
Return a end iterator. | |
bool | empty () |
Return true if the transaction is empty. | |
void | cancel () |
Cancel all queries in the transaction. | |
void | start () |
Initiate the transaction. | |
Private Attributes | |
std::vector< Item > | m_items |
Build a series of queries into a transaction.
By using this class to execute a series of queries you let the ASql engine handle insuring they are executed sequentially. Should an error or cancellation crop up in one query all changes made by preceding queries in the transaction will be rolled back and proceeding queries in the transaction will be dumped from the queue.
Note that if an error or cancellation occurs in a query that has no callback function, proceeding queries in the transaction will be checked for callback functions and the first one found will be called.
Note that the statement obviously MUST all be from the same connection.
Definition at line 1083 of file asql.hpp.
typedef std::vector<Item>::iterator ASql::Transaction< T >::iterator |
iterator ASql::Transaction< T >::begin | ( | ) | [inline] |
Return a starting iterator.
Definition at line 1116 of file asql.hpp.
References ASql::Transaction< T >::m_items.
Referenced by ASql::ConnectionPar< T >::queue().
void ASql::Transaction< T >::cancel | ( | ) |
void ASql::Transaction< T >::clear | ( | ) | [inline] |
Remove all queries from the transaction.
Definition at line 1112 of file asql.hpp.
References ASql::Transaction< T >::m_items.
bool ASql::Transaction< T >::empty | ( | ) | [inline] |
Return true if the transaction is empty.
Definition at line 1124 of file asql.hpp.
References ASql::Transaction< T >::m_items.
iterator ASql::Transaction< T >::end | ( | ) | [inline] |
Return a end iterator.
Definition at line 1120 of file asql.hpp.
References ASql::Transaction< T >::m_items.
Referenced by ASql::ConnectionPar< T >::queue().
void ASql::Transaction< T >::push | ( | Query & | query, |
T & | statement | ||
) | [inline] |
Add a query to the transaction.
This adds the query to the back of the line.
query | Query to add. |
statement | Associated statement. |
Definition at line 1108 of file asql.hpp.
References ASql::Transaction< T >::m_items.
void ASql::Transaction< T >::start | ( | ) | [inline] |
Initiate the transaction.
Definition at line 1134 of file asql.hpp.
References ASql::Transaction< T >::m_items.
std::vector<Item> ASql::Transaction< T >::m_items [private] |
Definition at line 1097 of file asql.hpp.
Referenced by ASql::Transaction< T >::begin(), ASql::Transaction< T >::clear(), ASql::Transaction< T >::empty(), ASql::Transaction< T >::end(), ASql::Transaction< T >::push(), and ASql::Transaction< T >::start().