Public Member Functions | |
| int | addField (const char *name, DataType type=typeUnknown, size_t length=0, const void *defaultValue=0, bool notNull=false) |
| adds a field to the schema definition. | |
| int | dropField (const char *name) |
| removes a field from the schema definition | |
| int | getFieldCount () |
| returns the total number of fields in this table definition | |
| size_t | getTupleSize () |
| returns the total tuple size in bytes. | |
Encapsulates the information or schema definition of a table.For Example say if
we need to create table with two fields, call addField method with necessary parameters
twice. Passed as argument to createTable method of DatabaseManager to create table.
| int TableDef::addField | ( | const char * | name, | |
| DataType | type = typeUnknown, |
|||
| size_t | length = 0, |
|||
| const void * | defaultValue = 0, |
|||
| bool | notNull = false | |||
| ) |
adds a field to the schema definition.
| name | field name | |
| type | data type of the field | |
| length | size of the field. used in case of char and binary data types. | |
| defaultValue | default value for the field. It is currently limited to 32 bytes. | |
| isPrimary | whether the field is primary key( not null + unique) | |
| notNull | whether the field can be null | |
| unique | whether the field values are unique |
| int TableDef::dropField | ( | const char * | name | ) |
removes a field from the schema definition
| name | field name |
| int TableDef::getFieldCount | ( | ) |
returns the total number of fields in this table definition
| size_t TableDef::getTupleSize | ( | ) |
returns the total tuple size in bytes.