RestoreObject adds the object currently handled by a table, using NewObject if there is not currently an object. Restores an object back to its original state at either BeginTransaction or CommitTransaction - which ever was last called, and that has been read, added, edited or deleted by any operation of ReadObject, AddObject, RewriteObject, DeleteObject.
unsigned __int64 RestoreObject (
   unsigned int tableID,
   __int64 objectID = 0,
   bool releaseObjectLock = true


tableIDthe table ID defining the table's handle.
objectIDthe objectID of the object to restore, if this value is left zero, it will try to restore the object currently within the table buffers.
releaseObjectLockto maintain a lock on the object for future use, set this value to false.

Return Values

If the method succeeds, the return value is zero else see error codes for more details.


  • The object that has been restored is no longer apart of the transaction, any edits are also undone and its locks will be freed if releaseObjectLock is true - even if ReadObject was called first.
  • If releaseObjectLock is set to false when restoring an object that was read only by ReadObject, this operation will do nothing
Example Use
  • C++
#include "ODBPP.h"

#define TABLE_FIRST 1

int wmain(int argc, wchar_t* argv[])
   unsigned __int64 error;
   CODBPP database;
   CODBPP::Object object;
   const char16_t *userName = u"UserName\0\0\0", *message;
   if((error = database.BeginTransaction()) == NO_ERROR
   && (error = database.OpenTable(TABLE_FIRST)) == NO_ERROR){
      error = database.DeleteObject(TABLE_FIRST,CODBPP::GREATER_EQUALTO,&object,1,userName);
      while(error == NO_ERROR && wcscmp(userName,(char16_t*)object.variable) == 0)
         error = database.DeleteObject(TABLE_FIRST,CODBPP::NEXT,&object,1);
      if(error == NO_ERROR) error = database.RestoreObject(TABLE_FIRST);
      if(error == NO_ERROR) error = database.CommitTransaction();
   if(error && database.GetErrorMessage(&message) == NO_ERROR)
   return NO_ERROR;

Also See

AddObject, DeleteObject, ReadObject, RewriteObject
Listen All
Comments (0)
Characters left: 2500
Ekky Software Homepage T-Accounts Online ObjectDatabase++ TScript Ekky Software Homepage T-Accounts Onlinee ObjectDatabase++ TScript