dbTableDescriptor Class Reference

#include <class.h>

List of all members.


Detailed Description

Table descriptor.

Public Member Functions

dbTableDescriptorgetNextTable ()
 Get next table in database.
dbFieldDescriptorfindSymbol (char const *name)
 Find field with specified symbol name.
dbFieldDescriptorfind (char const *name)
 Find field with specified name.
dbFieldDescriptorgetFirstField ()
 Get first record field.
int getLastValueOfAutoincrementCount () const
 Get last value of autoincrement counter used for this table.
dbFieldDescriptorgetNextField (dbFieldDescriptor *field)
 Get next field.
char * getName ()
 Get table name.
size_t size ()
 Get size of instance of the class in an application.
void setFlags ()
 Set fields flags.
bool equal (dbTable *table)
 Check whether table descriptor in the database is the same as table appplication table descriptor.
bool match (dbTable *table, bool confirmDeleteColumns)
 Check whether fprmats of table descriptor in the database and in application is compatible.
void checkRelationship ()
 Check consuistency of declared realations (check that referenced table actually contains declared inverse reference field).
dbDatabasegetDatabase ()
 Get reference to associated database.
void storeInDatabase (dbTable *table)
 Save table descriptor in the database.
 dbTableDescriptor (dbTable *table)
 Construct table descriptor using information stored in database.
 dbTableDescriptor (char const *tableName, dbDatabase *db, size_t objSize, describeFunc func, dbTableDescriptor *original=NULL)
 Constructor of application table descriptor.
 ~dbTableDescriptor ()
 Table descriptor destructor.

Static Public Member Functions

static void cleanup ()
 Remove all table descriptors except static ones.

Static Public Attributes

static int initialAutoincrementCount
 Initial value for autoincrement count.

Protected Types

typedef dbFieldDescriptor *(* describeFunc )()
 Function returning list of record fields descriptors.

Protected Member Functions

dbTableDescriptorclone ()
 Clone table descriptor.
size_t totalNamesLength ()
 Calculate total length of all names in table descriptor.
int calculateFieldsAttributes (dbFieldDescriptor *fieldsList, char const *prefix, int offs, int indexMask, int &attr)
 Recursively set field attributes.
dbFieldDescriptorbuildFieldsList (dbTable *table, char const *prefix, int prefixLen, int &attr)
 Read table definiton from the database and build fields list.

Protected Attributes

dbTableDescriptornext
 Chain of all tables in application.
dbTableDescriptornextDbTable
 Chain of all tables associated with database.
char * name
 Name of the table.
oid_t tableId
 Indetifier of table object in the database.
dbFieldDescriptorcolumns
 List of table columns.
dbFieldDescriptorhashedFields
 List of hashed fields.
dbFieldDescriptorindexedFields
 List of fields indexed by T-Ttree.
dbFieldDescriptorinverseFields
 List of related fields (fields, for which inverse references exist).
dbFieldDescriptorfirstField
 List of all fields.
dbFieldDescriptor ** nextFieldLink
 Pointer of next field of the last field (used for list construction).
dbDatabasedb
 Attached database.
bool fixedDatabase
 Database staticly attached to the table (by means of REGISTER_IN macro).
bool isStatic
 Table descriptor is static object created by one of REGISTER macros.
size_t appSize
 Size of tghe correspondent applciation object.
size_t fixedSize
 Size of fixed part of the records (without string and array bodies).
size_t nFields
 Number of fields in the table.
size_t nColumns
 Number of columns in the table.
int4 autoincrementCount
 Autoincremented counter for this table.
dbTableDescriptorcloneOf
 When unassigned table descriptor is explicitly assigned to the database, new clone of descriptor is created and cloneOf field of this descriptor referes to original table descriptor.
describeFunc describeComponentsFunc

Static Protected Attributes

static dbTableDescriptorchain

Friends

class dbCompiler
class dbDatabase
class dbReplicatedDatabase
class dbTable
class dbAnyCursor
class dbSubSql
class dbHashTable
class dbTtreeNode
class dbRtreePage
class dbServer
class dbColumnBinding
class dbFieldDescriptor
class dbAnyContainer
class dbCLI
class dbSelection

Member Typedef Documentation

typedef dbFieldDescriptor*(* describeFunc)() [protected]

Function returning list of record fields descriptors.


Constructor & Destructor Documentation

dbTableDescriptor ( dbTable table  ) 

Construct table descriptor using information stored in database.

Parameters:
table pointer to database table descriptor

dbTableDescriptor ( char const *  tableName,
dbDatabase db,
size_t  objSize,
describeFunc  func,
dbTableDescriptor original = NULL 
)

Constructor of application table descriptor.

Parameters:
tableName name of the table
db assigned database (may be NULL)
objSize size of application object
func function returninglist of field descriptors
original original table descriptor (for cloned descriptors)

Table descriptor destructor.


Member Function Documentation

dbTableDescriptor * clone (  )  [protected]

Clone table descriptor.

size_t totalNamesLength (  )  [protected]

Calculate total length of all names in table descriptor.

int calculateFieldsAttributes ( dbFieldDescriptor fieldsList,
char const *  prefix,
int  offs,
int  indexMask,
int &  attr 
) [protected]

Recursively set field attributes.

Parameters:
fieldsList list of record fields
prefix prefix for the field (in case of structures or arrays this functions is invoked resursively for components of this structure or or array
offs - offset in application class
indexMask index mask for the structore containing the field
attr attributes of the parent field
Returns:
alignment of the field

dbFieldDescriptor * buildFieldsList ( dbTable table,
char const *  prefix,
int  prefixLen,
int &  attr 
) [protected]

Read table definiton from the database and build fields list.

Parameters:
table databsae table descriptor
prefix prefix for the field (in case of structures or arrays
prefixLen length of the prefix
attr attributes of the parent field
Returns:
pointer to the constructed list

dbTableDescriptor* getNextTable (  )  [inline]

Get next table in database.

dbFieldDescriptor * findSymbol ( char const *  name  ) 

Find field with specified symbol name.

dbFieldDescriptor * find ( char const *  name  ) 

Find field with specified name.

dbFieldDescriptor* getFirstField (  )  [inline]

Get first record field.

Returns:
descriptor of first record field

int getLastValueOfAutoincrementCount (  )  const [inline]

Get last value of autoincrement counter used for this table.

Returns:
last value of autoincrement counter used for this table

dbFieldDescriptor* getNextField ( dbFieldDescriptor field  )  [inline]

Get next field.

Parameters:
field current field
Returns:
next field after the current in table fields list

char* getName (  )  [inline]

Get table name.

size_t size (  )  [inline]

Get size of instance of the class in an application.

void setFlags (  ) 

Set fields flags.

This method is called after loading table descriptor from database.

bool equal ( dbTable table  ) 

Check whether table descriptor in the database is the same as table appplication table descriptor.

Parameters:
table database table descriptor
Returns:
true if two table descriptors are equal

bool match ( dbTable table,
bool  confirmDeleteColumns 
)

Check whether fprmats of table descriptor in the database and in application is compatible.

This method also prepares information for performing conversion of record to new format

Parameters:
table database table descriptor
confirmDeleteColumns whether deletion of columns in allowed from non empty table
Returns:
true if no reformatting is needed

void checkRelationship (  ) 

Check consuistency of declared realations (check that referenced table actually contains declared inverse reference field).

This method also resolve references between table.

dbDatabase* getDatabase (  )  [inline]

Get reference to associated database.

Returns:
database to which this table is assigned

void storeInDatabase ( dbTable table  ) 

Save table descriptor in the database.

Parameters:
table place where to store table descriptor

void cleanup (  )  [static]

Remove all table descriptors except static ones.


Friends And Related Function Documentation

friend class dbCompiler [friend]

friend class dbDatabase [friend]

friend class dbReplicatedDatabase [friend]

friend class dbTable [friend]

friend class dbAnyCursor [friend]

friend class dbSubSql [friend]

friend class dbHashTable [friend]

friend class dbTtreeNode [friend]

friend class dbRtreePage [friend]

friend class dbServer [friend]

friend class dbColumnBinding [friend]

friend class dbFieldDescriptor [friend]

friend class dbAnyContainer [friend]

friend class dbCLI [friend]

friend class dbSelection [friend]


Member Data Documentation

dbTableDescriptor* next [protected]

Chain of all tables in application.

dbTableDescriptor * chain [static, protected]

Chain of all tables associated with database.

char* name [protected]

Name of the table.

oid_t tableId [protected]

Indetifier of table object in the database.

dbFieldDescriptor* columns [protected]

List of table columns.

List of hashed fields.

List of fields indexed by T-Ttree.

List of related fields (fields, for which inverse references exist).

List of all fields.

Pointer of next field of the last field (used for list construction).

dbDatabase* db [protected]

Attached database.

bool fixedDatabase [protected]

Database staticly attached to the table (by means of REGISTER_IN macro).

bool isStatic [protected]

Table descriptor is static object created by one of REGISTER macros.

size_t appSize [protected]

Size of tghe correspondent applciation object.

size_t fixedSize [protected]

Size of fixed part of the records (without string and array bodies).

size_t nFields [protected]

Number of fields in the table.

size_t nColumns [protected]

Number of columns in the table.

int4 autoincrementCount [protected]

Autoincremented counter for this table.

dbTableDescriptor* cloneOf [protected]

When unassigned table descriptor is explicitly assigned to the database, new clone of descriptor is created and cloneOf field of this descriptor referes to original table descriptor.

Initial value for autoincrement count.

To take effect, this value should be assigned before database open.


Online Library Docs

sipXecs home page

Version 4.2.1-018930 2010-07-31T01:13:23 build16 abuild