PutVariableValues

PutVariableValues replaces the values of variable fields.
unsigned __int64 PutVariableValues (
   unsigned int tableID,
   CODBPP::Object *object = NULL,
   unsigned int variableLength = 0
);
unsigned __int64 PutVariableValues (
   unsigned int tableID,
   const void* variableBuffer,
   unsigned int variableLength,
   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
variableLengthmaximun variableBuffer length in bytes, 0 for ignore
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
  • C++
#include "ODBPP.h"

#define TABLE_ONE 1

struct VariableObject{
   int FirstFixed;
   double SecondFixed;
   enum {FirstVar,SecondVar};
};

int wmain(int argc, wchar_t* argv[])
{
   unsigned __int64 error;
   CODBPP database;
   const char16_t *message = u"First variable field value.\0"
                             u"Second variable field value.";
   if(database.OpenDatabase(u"YourDatabase")
   || database.BeingTransaction()
   || database.OpenTable(TABLE_ONE)
   || database.ReadObject(TABLE_ONE,CODBPP::FIRST)
   || database.PutVariableValues(TABLE_ONE,str,112,VariableObject::FirstVar,2)
   || database.RewriteObject(TABLE_ONE)
   || database.CommitTransaction()){
      if(database.GetErrorMessage(&message) == NO_ERROR) MessageBox(message);
   }
   database.EndTransaction();
   database.CloseDatabase();
   return NO_ERROR;
}

Updated

Version 4.5.1

Also See

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