Home Home

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

tableID The table ID defining the table's handle.
variableBuffer Pointer to a buffer of variable fields.
variableStartField The position of the first variable field.
variableFieldCount The count of variable fields in the buffer.
object For the returned object addresses.
variableLength The 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 = _T"First variable field value.\0Second variable field value.";
    if(database.OpenDatabase(_T"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

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