Class ODBPP::Index
Used to represent a table index within the table schema.class Index{ public: unsigned char flags; unsigned char type; unsigned short segmentCount; union{ unsigned int length; struct{ unsigned short binaryLength; unsigned short maxObjects; }; }; CODBPP::Segment *segments; };
Members
flags | boolean values for fixed or variable and multi-entry type index, 0x01 = variable, 0x02 = multientry. |
type | CODBPP::IndexType value for the index. |
segmentCount | a counter for the number of segments in this index. |
length | if the index type equals CODBPP::B_TREE or CODBPP::S_TREE than the length for the fixed index or the average length for the variable index - (length * 4) = length in bytes. |
binaryLength | if the index type equals CODBPP::A_LIST or CODBPP::U_LIST, the length in bytes of the pre-token binary section. |
maxObjects | if the index type equals CODBPP::A_LIST or CODBPP::U_LIST, then pow(2,maxObjects) equals maximum object count before disregarding token value, typically token as "the" and "a" are removed from the index as they may provide too many hits. If this value is 0 then there is not maximum count. |
segments | pointer to an array of segments. |
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)