RestoreObject

ODBPPLib.IODBPP.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.
void RestoreObject (
   uint tableId,
   long Id64,
   bool releaseObjectLock
);

Parameters

tableIdthe table Id defining the table's handle.
Id64the 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

ReadObject returns the DatabaseObject with the newly found object's values.

Remarks

  • 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#
public static uint FIRST_TABLE = 1;
private void button1_Click(object sender, EventArgs e){
   try{
      ODBPPLib.ODBPP odbpp = new ODBPPLib.ODBPP();
      odbpp.OpenDatabase("C:\\My\\Database\\Control\\File.odc");
      odbpp.BeginTransaction(odbpp.SHARED, 60000);
      odbpp.OpenTable(FIRST_TABLE);
      result = odbpp.DeleteObject(FIRST_TABLE, odbpp.FIRST, 0, null);
      while(result != null){
         if(result.readField("First") != 123)
            odbpp.RestoreObject(FIRST_TABLE,0,true);
         result = odbpp.DeleteObject(FIRST_TABLE, odbpp.NEXT, 0);
      }
      odbpp.CommitTransaction(true);
   }
   catch (Exception e1) {
      MessageBox.Show(e1.Message);
   }
}

Also See

AddObject, DeleteObject, NewObject, 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