fastcgi++
Classes | Public Types | Public Member Functions | Private Attributes
ASql::Transaction< T > Class Template Reference

Build a series of queries into a transaction. More...

#include <asql.hpp>

List of all members.

Classes

struct  Item
 Ties query objects to their statements. More...

Public Types

typedef std::vector< Item >
::iterator 
iterator

Public Member Functions

void push (QueryPar &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 (int instance=-1)
 Initiate the transaction.

Private Attributes

std::vector< Itemm_items

Detailed Description

template<class T>
class ASql::Transaction< T >

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 55 of file asql.hpp.


Member Typedef Documentation

template<class T>
typedef std::vector<Item>::iterator ASql::Transaction< T >::iterator

Definition at line 71 of file asql.hpp.


Member Function Documentation

template<class T>
iterator ASql::Transaction< T >::begin ( ) [inline]

Return a starting iterator.

Definition at line 88 of file asql.hpp.

References ASql::Transaction< T >::m_items.

Referenced by ASql::ConnectionPar< T >::queue().

template<class T >
void ASql::Transaction< T >::cancel ( )

Cancel all queries in the transaction.

Definition at line 366 of file asql.hpp.

template<class T>
void ASql::Transaction< T >::clear ( ) [inline]

Remove all queries from the transaction.

Definition at line 84 of file asql.hpp.

References ASql::Transaction< T >::m_items.

template<class T>
bool ASql::Transaction< T >::empty ( ) [inline]

Return true if the transaction is empty.

Definition at line 96 of file asql.hpp.

References ASql::Transaction< T >::m_items.

template<class T>
iterator ASql::Transaction< T >::end ( ) [inline]

Return a end iterator.

Definition at line 92 of file asql.hpp.

References ASql::Transaction< T >::m_items.

Referenced by ASql::ConnectionPar< T >::queue().

template<class T>
void ASql::Transaction< T >::push ( QueryPar query,
T &  statement 
) [inline]

Add a query to the transaction.

This adds the query to the back of the line.

Parameters:
queryQueryPar to add.
statementAssociated statement.

Definition at line 80 of file asql.hpp.

References ASql::Transaction< T >::m_items.

template<class T>
void ASql::Transaction< T >::start ( int  instance = -1) [inline]

Initiate the transaction.

Definition at line 106 of file asql.hpp.

References ASql::Transaction< T >::m_items.


Member Data Documentation

template<class T>
std::vector<Item> ASql::Transaction< T >::m_items [private]

The documentation for this class was generated from the following files: