CommitTransaction
CommitTransaction executes the transaction log file, releasing all
object locks if releaseObjectLocks is true else the current transaction
will retain all the objects lock making CommitTransaction funtion like a
save point.
unsigned int CommitTransaction(
bool releaseObjectLocks = true
);
Parameters
| releaseObjectLocks |
If this is set to false, this method acts as a save point, committing 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
If this method is not called before EndTransaction
or CloseDatabse, then the transaction is
aborted.
Then releaseObjectLocks is set true, the object within the table handles
are removes so any call to ReadObject or
DeleteObject using CODBPP::NEXT or
CODBPP::PREVIOUS will fail.
Example Use
CODBPP::Object object;
struct FixedObject{
int First;
double Second;
} *fixedObject;
unsigned int tableID = 1;
if((error = database.BeginTransaction()) == NO_ERROR
&& (error = database.OpenTable(tableID)) == NO_ERROR
&& (error = database.NewObject(tableID,&object)) == NO_ERROR){
fixedObject = (struct FixedObject*)object.fixed;
fixedObject->First = 456;
fixedObject->Second = 456.789;
if((error = database.AddObject(tableID)) == NO_ERROR){
error = database.CommitTransaction();
}
if(error && database.GetErrorMessage(&message) == NO_ERROR)
MessageBox(message);
database.EndTransaction();
Also See
AbortTransaction,
BeginTransaction, EndTransaction
Copyright © 2003-2008, Ekky Software Pty. Ltd.