
Class ODBPP::Field
Used to represent a field within the table schema.class Field{
public:
   enum DataType type;
   unsigned int offset;
   unsigned int length;
   unsigned short subFieldCount;
   unsigned short subFieldTotal;
   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 | for CODBPP::SUB_TABLE, counts all the fields in this sub-table, ie the length of subFields. | 
| subFieldTotal | for CODBPP::SUB_TABLE, counts the total fields in just this sub-table object, including any other nested subfields, added v4.6, enable in v4.7. | 
| 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,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)

