AbortTransaction
AbortTransaction returns the current transaction to its original state,
it could be the state at the beginning of the transaction or after the last
CommitTransaction.
unsigned int AbortTransaction(
bool releaseObjectLocks = true
);
Parameters
| releaseObjectLocks |
If this is set to false, this method acts as an unsave point, undoing all
adds, edits and deletes, but not releasing any object locks. |
Return Values
If the method succeeds, the return value is zero else see
error codes for more details.
Remarks
Example Use
#define FIRST_TABLE 1
CODBPP::Object object;
struct FixedObject{
int First;
double Second;
} *fixedObject;
unsigned int error = NO_ERROR;
char *message;
if((error = database.BeginTransaction()) == NO_ERROR
&& (error = database.OpenTable(FIRST_TABLE)) == NO_ERROR){
while(error == NO_ERROR){
if((error = database.NewObject(FIRST_TABLE,&object)) == NO_ERROR){
fixedObject = (struct FixedObject*)object.fixed;
fixedObject->First = 456;
fixedObject->Second = 456.789;
if((error = database.AddObject(FIRST_TABLE,&object)) == NO_ERROR){
if(object.ID > 30){
error = database.AbortTransaction();
break;
}
if(object.ID > 25) break;
}
}
}
if(error == NO_ERROR) error = database.CommitTransaction();
}
if(error && database.GetErrorMessage(&message) == NO_ERROR)
MessageBox(message);
database.EndTransaction();
Also See
BeginTransaction,
CommitTransaction, EndTransaction
Copyright © 2003-2007, Ekky Software.