Class ODBPP::Segment
Used to represent an index segment within the index of a table.class Segment{ public: int field; enum CODBPP::Mode mode; };
Members
field |
Valid values are -1 for the objectID and -2 for the row count with multi-entry
indexes, all others values are the schema array index value of the field. The
absolute field positon values for sub-table fields are as follws in the diagram below. |
mode | Valid modes for types within CODBPP::B_TREE index types are CODBPP::ASTR and CODBPP::USTR are CODBPP::DESCENDING or CODBPP::INVERTED or (CODBPP::TO_UPPER_CASE xor CODBPP::TO_LOWER_CASE). Valid modes for all types are CODBPP::DESCENDING or CODBPP::NONE. Valid modes for type within CODBPP::S_TREE indexes are CODBPP::NONE only. Valid modes for type within CODBPP::A_LIST and CODBPP::U_LIST indexes are CODBPP::TOKEN_FIELD or (CODBPP::TO_UPPER_CASE xor CODBPP::TO_LOWER_CASE), the binary fields within a token index are by default value. |
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)