PutVariableValues

PutVariableValues replaces the values of variable fields.
unsigned int PutVariableValues (
   unsigned int tableID,
   CODBPP::Object *object = NULL,
   unsigned int variableLength = 0
);
unsigned int PutVariableValues (
   unsigned int tableID,
   const void* variableBuffer,
   unsigned int variableStartField,
   unsigned int variableFieldCount,
   CODBPP::Object *object = NULL
);

Parameters

tableIDthe table ID defining the table's handle.
variableBufferpointer to a buffer of variable fields
variableStartFieldthe position of the first variable field.
variableFieldCountthe count of variable fields in the buffer.
objectfor the returned object addresses.
variableLengththe length of raw data only (eg strlen(name)) required to place values yourself.

Return Values

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

Remarks

  • If variableBuffer is NULL, then PutVariableValues will zero all the fields specified.
  • The first version of Put Variable Values operates very similar to NewObject and can be dangerous if the schema of the table has changed as it will zero all variable fields.
Example Use
#define TABLE_ONE 1
struct VariableObject{
   int First;
   double Second;
   enum {FirstVar,SecondVar};
};
CODBPP database;
const char16_t *message = TEXT("First variable field value.Second variable field value.");
if(database.OpenDatabase(TEXT("YourDatabase"))
|| database.BeingTransaction()
|| database.OpenTable(TABLE_ONE)
|| database.ReadObject(TABLE_ONE,CODBPP::FIRST)
|| database.PutVariableValues(TABLE_ONE,str,VariableObject::FirstVar,2)
|| database.RewriteObject(TABLE_ONE)
|| database.CommitTransaction()){
  if(database.GetErrorMessage(&message) == NO_ERROR) MessageBox(message);
}
database.EndTransaction();
database.CloseDatabase();

Also See

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