NewObject
NewObject create a new object buffer for the give table handle.unsigned __int64 NewObject ( unsigned int tableID, CODBPP::Object *object = NULL, unsigned int variableLength = 0 );
Parameters
tableID | the table ID defining the table's handle. |
object | for the returned object addresses. |
variableLength | Optional variable length |
Return Values
If the method succeeds, the return value is zero else see error codes for more details.Remarks
Example Use
- C++
#include "ODBPP.h" #define FIRST_TABLE 1 struct Field{ int first; double second; } *field; int wmain(int argc, wchar_t* argv[]) { unsigned __int64 error; const char16_t *str = u"new field value", *message; CODBPP database; CODBPP::Object object; if((error = database.BeginTransaction()) == NO_ERROR && (error = database.OpenTable(FIRST_TABLE)) == NO_ERROR && (error = databse.NewObject(FIRST_TABLE,&object,wcslen(str)<<1)) == NO_ERROR){ field = (stuct Field*)object.fixed; field->first = 345; field->second = 678.9; wcscpy((char16_t*)object.variable,str); if((error = database.AddObject(FIRST_TABLE)) == NO_ERROR) error= database.CommitTransaction(); } if(error && database.GetErrorMessage(&message) == NO_ERROR) MessageBox(message); database.EndTransaction(); return NO_ERROR; }
Also See
AddObject, DeleteObject, ReadObject, RewriteObjectListen All
Comments (0)