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
tableID | the table ID defining the table's handle. |
variableBuffer | pointer to a buffer of variable fields |
variableLength | maximun variableBuffer length in bytes, 0 for ignore |
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
- 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, GetVariableFieldListen All
Comments (0)