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 __int64 AbortTransaction(
   bool releaseObjectLocks = true


releaseObjectLocksIf 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.


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

#define FIRST_TABLE 1
CODBPP::Object object;
struct FixedObject{
   int First;
   double Second;
} *fixedObject;

int wmain(int argc, wchar_t* argv[])
   unsigned __int64 error;
   const char16_t *message;
   CODBPP database;
   CODBPP::Object object;
   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();
               if(object.ID > 25) break;
      if(error == NO_ERROR) error = database.CommitTransaction();
   if(error && database.GetErrorMessage(&message) == NO_ERROR)
   return NO_ERROR;

Also See

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