ReadObject

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.
unsigned int ReadObject (
	unsigned int tableID,
	__int64 objectID,
	CODBPP::Object *object = NULL
);
unsigned int ReadObject (
	unsigned int tableID,
	__int64 objectID,
	CODBPP::Mode operation,
	CODBPP::Object *object = NULL
);
unsigned int ReadObject (
	unsigned int tableID,
	CODBPP::Mode operation,
	CODBPP::Object *object = NULL,
	unsigned int index = 0,
	const void *key = NULL,
	unsigned int *matchingRow = NULL
);

Parameters

tableID The table ID defining the table's handle.
objectID The object ID defining the object's handle when using the shorthand version.
operation Valid operations only.
object For the returned object addresses.
index The index value, 0 for object ID hash index, 1 for the first defined index.
key The key value used in any find comparison.
matchingRow Used to identify which row of a sub-table field, within the current object has the matching multi-entry index value.

Return Values

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

Remarks


Warning: Division by zero in /home/dclarke/public_html/content/Documentation/CODBPP/ReadObject.php on line 94
  • 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 CODBPP::NO_LOCKif 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 CODBPP::NO_WAIT and CODBPP::UNABLE_TO_LOCK_OBJECT.
Example Use
#define FIRST_TABLE 1
CODBPP::Object object;
struct FixedObject{
   int First;
   double Second;
} *fixedObject;
unsigned int error;
char16_t *userName = TEXT("UserName"), *message, buffer[128];
if((error = database.BeginTransaction()) == NO_ERROR
&& (error = database.OpenTable(FIRST_TABLE)) == NO_ERROR
&& (error = database.ReadObject(FIRST_TABLE,
                   CODBPP::EQUALTO,&object,1,userName)) == NO_ERROR){
    fixedObject = (struct FixedObject*)object.fixed;
    swprintf(buffer,TEXT("First = %d, Second = %g"),
                   fixedObject->First, fixedObject->Second);
    MessageBox(buffer);
}
if(error && database.GetErrorMessage(&message) == NO_ERROR)
   MessageBox(message);
database.EndTransaction();

Also See

AddObject, DeleteObject, NewObject, RewriteObject, RestoreObject
 

Contact Ekky Software

All around the world Ekky Software is contactable seven days of the week by submitting the following details.

Thank you for your time and interest.
Ekky Software Customer Support Team.

Ekky Software Product Range
Ekky Software Homepage Texas Business Software ObjectDatabase++ TScript Ekky Software Homepage Texas Business Software ObjectDatabase++ TScript