Class ODBPP::Field
Used to represent a field within the table schema.class Field{ public: enum CODBPP::DataType type; unsigned int offset; unsigned int length; unsigned int subFieldCount; char16_t *name; Field *subFields; };
Members
type | value for the field's data type. |
offset | offset from the begining of the object buffer, or the offset of the variable length fields. |
length | the length of the field or the expected length for variable fields - in bytes. |
subFieldCount | contains a count of the next fields that are a part of the sub-table. |
name | '\0' terminating string for the field name. |
subFields | For type CODBPP::SUB_TABLE, an array fields that make the sub table |
Remarks
Example Use
- C++
#include "ODBPP.h" CODBPP::Segment index1Segments[] = {{0,(CODBPP::Mode)0}}; CODBPP::Index indexes[] = {{0,CODBPP::B_TREE,1,0,index1Segments} CODBPP::Field fields[] = { {CODBPP::UINT32, 0, 4, 0,u"First"}, {CODBPP::FLOAT64,8, 8, 0,u"Second"}, {CODBPP::ASTR, 16,32,0,u"Third"} }; CODBPP::Schema schema = {0,1,0,0,3,0,u"Table Name",NULL,fields, indexes}; int wmain(int argc, wchar_t* argv[]) { unsigned __int64 error; const char16_t *message; CODBPP database; if(database.OpenDatabase(u"YourDatabase") == NO_ERROR){ if((error = database.BeginTransaction(CODBPP::EXCLUSIVE)) == NO_ERROR){ if((error = database.CreateTable(&schema)) == NO_ERROR){ ... } } if(error && database.GetErrorMessage(&message) == NO_ERROR) MessageBox(message); database.EndTransaction(); } return NO_ERROR; }
Also See
CreateTable, GetTableSchema, SetTableSchemaListen All
Comments (0)