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

flagsboolean values for fixed or variable and multi-entry type index, 0x01 = variable, 0x02 = multientry.
typeCODBPP::IndexType value for the index.
segmentCounta counter for the number of segments in this index.
lengthif 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.
binaryLengthif the index type equals CODBPP::A_LIST or CODBPP::U_LIST, the length in bytes of the pre-token binary section.
maxObjectsif 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.
segmentspointer 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, SetTableSchema
Listen All
Comments (0)
Characters left: 2500
 

Contact Ekky

Thanks for your interest.

Ekky Software Customer Support Team.

Ekky Software Product Range
Ekky Software Homepage T-Accounts Online ObjectDatabase++ TScript Ekky Software Homepage T-Accounts Onlinee ObjectDatabase++ TScript