Home Home

RewriteObject

RewriteObject is used in conjunction with ReadObject to change the values of the object.
unsigned int RewriteObject (
	unsigned int tableID,
	CODBPP::Object *object = NULL
);

Parameters

tableID The table ID defining the table's handle.
object For the returned object addresses.

Return Values

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

Remarks

Example Use

CODBPP::Object object;
struct FixedObject{
   int First;
   double Second;
} *fixedObject;
char16_t *userName = _T"UserName";
if((error = database.BeginTransaction()) == NO_ERROR){
   if((error = database.OpenTable(1)) == NO_ERROR){
      if((error = database.ReadObject(1,CODBPP::EQUALTO,&object,1,userName)) == NO_ERROR){
         fixedObject = (struct FixedObject*)object.fixed;
         fixedObject->First = 123;
         fixedObject->Second = 456.789;
         if((error = database.RewriteObject(1)) == NO_ERROR)
            error = database.CommitTransaction();
      }
   }
}
if(error && database.GetErrorMessage(&message) == NO_ERROR)
   MessageBox(message);
database.EndTransaction();

Also See

AddObject, NewObject, DeleteObject, ReadObject, RestoreObject

Copyright © 2003-2008, Ekky Software Pty. Ltd.