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 int 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
#define TABLE_FIRST 1
CODBPP::Object object;
char16_t *userName = TEXT("UserName"), *message;
unsigned int error;
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)

Also See

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