
Class ODBPP::Schema
Used to represent a table within the database.class Schema{ public: unsigned short indexLockOrder; unsigned short indexCount; unsigned int tableID; unsigned int tableLockOrder; unsigned short fieldCount; unsigned short fieldTotal; unsigned int flags; char16_t *tableName; char16_t *indexPath; Field *fields; Index *indexes; };
Members
indexLockOrder | the index that the global locking order is to adhere to - 0 for the ObjectID. |
indexCount | the amount of indexes - the length of the indexes array. |
tableID | the table's identifier. |
tableLockOrder | the position that this table is in the global locking order. |
fieldCount | the amount of fields - the length of the fields array. |
fieldTotal | total field count including all subfields, added v4.6, enable in v4.7. |
flags | 0x01 - 64 bit Object IDs, 0 = no, 1 = yes 0x02 - Inverted index lock order, 0 = no, 1 = yes 0xf0 - 2^((flags>>4)&0xf) = #pragma pack value, 0 = defaults to 8 for Windows 64 bit classes. 4 for Windows 32 bit, Linux 32 & 64 bit classes, added v4.7 |
tableName | '\0' terminating string for the table name. |
indexPath | '\0' terminating string for the index file path - null if using the same directory as the table file. |
fields | pointer to an array of fields. |
indexes | pointer to an array of indexes. |
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,0,u"First"}, {CODBPP::FLOAT64,8, 8, 0,0,u"Second"}, {CODBPP::ASTR, 16,32,0,0,u"Third"} }; CODBPP::Schema schema = {0,1,0,0,3,0,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)