ReadObject

ODBPPLib.IODBPP.ReadObject finds an object matching the search values, reads the object into the table's buffers and locks the object, this operation does not log or back-up the object.
DatabaseObject ReadObject (
   uint tableId,
   uint mode,
   uint index,
   object key,
);

Parameters

tableIdthe table Id defining the table's handle.
modevalid mode operations only.
indexthe index value, 0 for object ID hash index, 1 for the first defined index.
keythe key value used in any find comparison.

Return Values

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

Remarks

  • ReadObject can be used before DeleteObject or RewriteObject to enable 2-phased commit protocols.
  • ReadObject will attempt to lock twenty times longer if the object is above the transaction's high water mark, if the object is below the mark than ReadObject will return an error if unable to gain object lock.
  • ReadObject will allow the operation of ODBPP.NO_LOCK if the object is un-important to the finial results of the transaction and locking would only block other transactions from completing.
  • ReadObject will allow the operation of ODBPP.NO_WAIT and ODBPP.SHORT_WAIT if the object is known to be locked and there is little need to wait the entire timeout period before returning.
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);
      uint objectId = 1;
      result = odbpp.ReadObject(FIRST_TABLE, odbpp.GREATER_EQUALTO, 0, objectId);
      if(result != null && result.readField("First") == 123)
      {
         MessageBox.Show("Found Object with second value as "+result.readField(1));
      }
   }
   catch (Exception e1)
   {
      MessageBox.Show(e1.Message);
   }
}

Also See

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