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 __int64 CommitTransaction(
   bool releaseObjectLocks = true
);

Parameters

releaseObjectLocksif 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

Example Use
  • C++
#include "ODBPP.h"

int wmain(int argc, wchar_t* argv[])
{
   unsigned __int64 error;
   const char16_t *message;
   CODBPP database;
   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();
   return NO_ERROR;
}

Also See

AbortTransaction, BeginTransaction, EndTransaction
Listen All
Comments (0)
Characters left: 2500
 
Ekky Software Homepage T-Accounts Online ObjectDatabase++ TScript Ekky Software Homepage T-Accounts Onlinee ObjectDatabase++ TScript