TableDef Class Reference

Represents table definition used to create the table. More...


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.


Detailed Description

Represents table definition used to create the table.

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.


Member Function Documentation

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.

Parameters:
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
Returns:
int

int TableDef::dropField ( const char *  name  ) 

removes a field from the schema definition

Parameters:
name field name
Returns:
int

int TableDef::getFieldCount (  ) 

returns the total number of fields in this table definition

Returns:
int no of fields

size_t TableDef::getTupleSize (  ) 

returns the total tuple size in bytes.

Returns:
size_t tuple size


The documentation for this class was generated from the following file:
CSQL Project Page