VisualIB  1.0
IBExpress library for making use of Borland IBExpress outside of C++Builder
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
VIB::Transaction Class Reference

VIB::Transaction wraps the VisualIB VIBTransaction structure with a C++11 object which emulates the semantics of Borland TIBTransaction. More...

#include <classVIBTransaction.h>

Classes

class  DatabasesClass
 Property implementation class for the Databases property. More...
 
class  ParamClass
 Property implementation class for parameters. More...
 

Public Member Functions

 Transaction (VIBTransaction *pvtr=NULL)
 Construct a new VIB::Transaction.
 
virtual ~Transaction ()
 Destroy the VIB::Transaction object and the VIBTransaction it wraps.
 
int Call (int ErrCode, bool RaiseError)
 Returns an error message based on the error code.
 
void Commit ()
 Permanently stores updates, insertions, and deletions of data associated with the current transaction, and ends the current transaction.
 
void CommitRetaining ()
 Commits the active transaction and retains the transaction context.
 
void Rollback ()
 Cancels all updates, insertions, and deletions for the current transaction and ends the transaction.
 
void RollbackRetaining ()
 Cancels all updates, insertions, and deletions for the current transaction and retains the transaction context.
 
void StartTransaction ()
 Begins a new transaction against the database server.
 
void CheckInTransaction ()
 Checks whether the transaction is active and whether there are any databases in the transaction's database list.
 
void CheckNotInTransaction ()
 Checks that the transaction is not active and that there are no databases in the transaction's database list.
 
void CheckAutoStop ()
 Undocumented method.
 
int AddDatabase (Database *db)
 Associates a database to the transaction.
 
int FindDatabase (Database *db)
 Finds the index of the associated database.
 
VIBDatabaseFindDefaultDatabase ()
 Undocumented method.
 
void RemoveDatabase (int Idx)
 Disassociates a database from the transaction.
 
void RemoveDatabases ()
 Disassociates all databases from the transaction.
 
void CheckDatabasesInList ()
 Checks if there are any databases in the list.
 
VIBTransactiongetVIBTransaction () const
 Obtain the underlying VisualIB VIBTransaction C structure instance.
 

Public Attributes

Property< bool > Active
 Specifies whether or not a transaction is active.
 
Property< VIBAutoStopAction > AutoStopAction
 Undocumented property.
 
Property< int > DatabaseCount
 Indicates the number of databases that are part of the transaction.
 
Property< VIBTransactionAction > DefaultAction
 Specifies what action a transaction should take upon timing out.
 
Property< VIBDatabase * > DefaultDatabase
 Sets or returns the default database for the transaction.
 
Property< void * > Handle
 Returns the transaction handle.
 
Property< bool > HandleIsShared
 Indicates whether or not the handle is shared.
 
Property< int > IdleTimer
 Specifies how long the transaction should wait before automatically committing or rolling back, based on the DefaultAction property.
 
Property< bool > InTransaction
 Indicates whether a database transaction is in progress or not.
 
Property< ParamClass * > Params
 Returns the transaction parameter buffer.
 
Property< int > SQLObjectCount
 Returns the number of currently active datasets, SQL objects, and blobs associated with the database.
 
Property< char * > TPB
 Provides a read-only view of the transaction parameter buffer.
 
Property< short > TPBLength
 Use to retrieve the length of the transaction parameter buffer.
 
ArrayProperty< DatabasesClass
*, VIBDatabase * > 
Databases
 Use to obtain the database at a given integer index.
 

Protected Attributes

VIBTransactionvtr
 Pointer to the wrapped VIBTransaction instance.
 
DatabasesClass dbObject
 Instance of Databases property wrapper.
 
ParamClass paramObject
 Instance of Params property wrapper.
 

Friends

class ParamClass
 

Detailed Description

VIB::Transaction wraps the VisualIB VIBTransaction structure with a C++11 object which emulates the semantics of Borland TIBTransaction.

Constructor & Destructor Documentation

VIB::Transaction::Transaction ( VIBTransaction pvtr = NULL)

Construct a new VIB::Transaction.

Parameters
[in]pvtrOptional pointer to an existing VIBTransaction instance of which this object should take ownership.

Member Function Documentation

int VIB::Transaction::AddDatabase ( Database db)

Associates a database to the transaction.

Parameters
[in]dbPointer to a VIB::Database instance.
Returns
Index of the database
Note
Reimplements TIBTransaction::AddDatabase
API Difference - The parameter taken is a VIB::Database instance. The corresponding TIBDatabase is wrapped within the VIB::Database's VIBDatabase structure.
int VIB::Transaction::Call ( int  ErrCode,
bool  RaiseError 
)

Returns an error message based on the error code.

Internal method used to make calls to the InterBase API, giving the option of throwing an exception or returning an error.

Parameters
[in]ErrCodeInterBase API error code?
[in]RaiseErrorIf true, an exception will be thrown.
Returns
Error message?
Note
Reimplements TIBTransaction::Call
void VIB::Transaction::CheckAutoStop ( )

Undocumented method.

Note
Reimplements TIBTransaction::CheckAutoStop
void VIB::Transaction::CheckDatabasesInList ( )

Checks if there are any databases in the list.

IF there are none, an exception will be thrown.

Note
Reimplements TIBTransaction::CheckDatabasesInList
void VIB::Transaction::CheckInTransaction ( )

Checks whether the transaction is active and whether there are any databases in the transaction's database list.

If either condition is false, an exception is thrown.

Note
Reimplements TIBTransaction::CheckInTransaction
void VIB::Transaction::CheckNotInTransaction ( )

Checks that the transaction is not active and that there are no databases in the transaction's database list.

If either condition is false, an exception is thrown.

Note
Reimplements TIBTransaction::CheckNotInTransaction
void VIB::Transaction::Commit ( )

Permanently stores updates, insertions, and deletions of data associated with the current transaction, and ends the current transaction.

If there is no current transaction, an exception will be thrown.

Note
Reimplements TIBTransaction::Commit
void VIB::Transaction::CommitRetaining ( )

Commits the active transaction and retains the transaction context.

Note
Reimplements TIBTransaction::CommitRetaining
int VIB::Transaction::FindDatabase ( Database db)

Finds the index of the associated database.

Parameters
[in]dbPointer to a VIB::Database instance.
Returns
Index of the associated database.
Note
Reimplements TIBTransaction::FindDatabase
API Difference - The parameter taken is a VIB::Database instance. The corresponding TIBDatabase is wrapped within the VIB::Database's VIBDatabase structure.
VIBDatabase * VIB::Transaction::FindDefaultDatabase ( )

Undocumented method.

Returns
Pointer to the default database?
Note
Reimplements TIBTransaction::FindDefaultDatabase
API Difference - The return value is a pointer to a VIBDatabase instance. The corresponding TIBDatabase is hidden by the VisualIB C API abstraction.
VIBTransaction* VIB::Transaction::getVIBTransaction ( ) const
inline

Obtain the underlying VisualIB VIBTransaction C structure instance.

Returns
Pointer to the wrapped VIBTransaction instance.
void VIB::Transaction::RemoveDatabase ( int  Idx)

Disassociates a database from the transaction.

Parameters
[in]IdxIndex of the database, as returned by FindDatabase.
Note
Reimplements TIBTransaction::RemoveDatabase
void VIB::Transaction::RemoveDatabases ( )

Disassociates all databases from the transaction.

Note
Reimplements TIBTransaction::RemoveDatabases
void VIB::Transaction::Rollback ( )

Cancels all updates, insertions, and deletions for the current transaction and ends the transaction.

If there is no current transaction, an exception will be thrown.

Note
Reimplements TIBTransaction::Rollback
void VIB::Transaction::RollbackRetaining ( )

Cancels all updates, insertions, and deletions for the current transaction and retains the transaction context.

Note
Reimplements TIBTransaction::RollbackRetaining
void VIB::Transaction::StartTransaction ( )

Begins a new transaction against the database server.

Before calling, an application should check the status of the InTransaction property. Updates, insertions, and deletions that take place after a call to StartTransaction are held by the server until an application calls Commit to save the changes or Rollback to cancel them.

Note
Reimplements TIBDatabase::StartTransaction

Member Data Documentation

Property<bool> VIB::Transaction::Active

Specifies whether or not a transaction is active.

Note
Reimplements TIBTransaction::Active
Property<VIBAutoStopAction> VIB::Transaction::AutoStopAction

Undocumented property.

Note
Reimplements TIBTransaction::AutoStopAction
See Also
VIBAutoStopAction
Property<int> VIB::Transaction::DatabaseCount

Indicates the number of databases that are part of the transaction.

Note
Read-only property.
Reimplements TIBTransaction::DatabaseCount
ArrayProperty<DatabasesClass *, VIBDatabase *> VIB::Transaction::Databases

Use to obtain the database at a given integer index.

Note
Read-only property.
Reimplements TIBTransaction::Databases.
API Difference - Each index of the array is a pointer to a VIBDatabase instance. The corresponding TIBDatabase instances are hidden by the VisualIB C API abstraction.
Property<VIBTransactionAction> VIB::Transaction::DefaultAction

Specifies what action a transaction should take upon timing out.

Note
Reimplements TIBTransaction::DefaultAction
Property<VIBDatabase *> VIB::Transaction::DefaultDatabase

Sets or returns the default database for the transaction.

Note
Reimplements TIBTransaction::DefaultDatabase
API Difference - The property type is VIBDatabase. The corresponding TIBDatabase instance is hidden by the VisualIB C API abstraction.
Property<void *> VIB::Transaction::Handle

Returns the transaction handle.

Note
Read-only property.
Reimplements TIBTransaction::Handle.
API Difference - The property type is equivalent to Ibexternals::PVoid.
Property<bool> VIB::Transaction::HandleIsShared

Indicates whether or not the handle is shared.

Note
Read-only property.
Reimplements TIBTransaction::HandleIsShared
Property<int> VIB::Transaction::IdleTimer

Specifies how long the transaction should wait before automatically committing or rolling back, based on the DefaultAction property.

Note
Reimplements TIBTransaction::IdleTimer
Property<bool> VIB::Transaction::InTransaction

Indicates whether a database transaction is in progress or not.

Note
Read-only property. Call StartTransaction to begin a transaction, and Commit or Rollback to end it.
Reimplements TIBTransaction::InTransaction
Property<ParamClass *> VIB::Transaction::Params

Returns the transaction parameter buffer.

Use to examine and set parameters in the buffer. Refer to the InterBase API Guide for the names of the parameters to provide.

Note
Reimplements TIBTransaction::Params
Property<int> VIB::Transaction::SQLObjectCount

Returns the number of currently active datasets, SQL objects, and blobs associated with the database.

Note
Read-only property.
Reimplements TIBTransaction::SQLObjectCount
Property<char *> VIB::Transaction::TPB

Provides a read-only view of the transaction parameter buffer.

Note
Reimplements TIBTransaction::TPB
Property<short> VIB::Transaction::TPBLength

Use to retrieve the length of the transaction parameter buffer.

Note
Read-only property.
Reimplements TIBTransaction::TPBLength

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