Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends

dbTableDescriptor Class Reference

#include <class.h>

List of all members.

Public Member Functions

dbTableDescriptorgetNextTable ()
dbFieldDescriptorfindSymbol (char_t const *name)
dbFieldDescriptorfind (char_t const *name)
dbFieldDescriptorgetFirstField ()
int getLastValueOfAutoincrementCount () const
dbFieldDescriptorgetNextField (dbFieldDescriptor *field)
char_t * getName ()
size_t size ()
oid_t getId ()
bool equal (dbTable *table, bool ignoreIndices=false)
bool match (dbTable *table, bool confirmDeleteColumns, bool preserveExistedIndices, bool isEmpty)
bool checkRelationship ()
dbDatabasegetDatabase ()
void storeInDatabase (dbTable *table)
void setFlags ()
void link ()
void unlink ()
 dbTableDescriptor (dbTable *table)
 dbTableDescriptor (char_t const *tableName, dbDatabase *db, size_t objSize, describeFunc func, dbTableDescriptor *original=NULL)
 ~dbTableDescriptor ()

Static Public Member Functions

static dbMutex & getChainMutex ()
static void cleanup ()

Static Public Attributes

static int initialAutoincrementCount

Protected Types

typedef dbFieldDescriptor *(* describeFunc )()

Protected Member Functions

size_t totalNamesLength ()
void calculateFieldsAttributes (dbFieldDescriptor *fieldsList, char_t const *prefix, int offs, int indexMask, int &attr, size_t &dbsAlignment, size_t &appAlignment)
dbFieldDescriptorbuildFieldsList (dbTable *table, char_t const *prefix, int prefixLen, int &attr)
dbTableDescriptorclone ()

Protected Attributes

dbTableDescriptornext
dbTableDescriptornextDbTable
char_t * name
oid_t tableId
dbFieldDescriptorcolumns
dbFieldDescriptorhashedFields
dbFieldDescriptorindexedFields
dbFieldDescriptorinverseFields
dbFieldDescriptorfirstField
dbFieldDescriptor ** nextFieldLink
dbDatabasedb
bool fixedDatabase
bool isStatic
dbTableDescriptorcloneOf
size_t appSize
size_t fixedSize
size_t nFields
size_t nColumns
oid_t firstRow
oid_t lastRow
size_t nRows
int4 autoincrementCount
dbTableDescriptornextBatch
bool isInBatch
dbSelection batch
int transactionId
int attr
describeFunc describeComponentsFunc
dbTableDescriptorcollisionChain

Static Protected Attributes

static dbTableDescriptorchain
static dbMutex * chainMutex

Friends

class dbCompiler
class dbDatabase
class dbReplicatedDatabase
class dbTable
class dbAnyCursor
class dbSubSql
class dbParallelQueryContext
class dbServer
class dbSession
class dbAnyContainer
class dbColumnBinding
class dbFieldDescriptor
class dbSelection
class dbTableIterator
class dbCLI
class dbFileTransactionLogger

Detailed Description

Table descriptor


Member Typedef Documentation

Function returning list of record fields descriptors


Constructor & Destructor Documentation

dbTableDescriptor::dbTableDescriptor ( dbTable table  ) 

Construct table descriptor using information stored in database

Parameters:
table pointer to database table descriptor
dbTableDescriptor::dbTableDescriptor ( char_t 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 roiginal table descriptor (for cloned descriptors)
dbTableDescriptor::~dbTableDescriptor (  ) 

Table descriptor destructor


Member Function Documentation

dbFieldDescriptor* dbTableDescriptor::buildFieldsList ( dbTable table,
char_t 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
void dbTableDescriptor::calculateFieldsAttributes ( dbFieldDescriptor fieldsList,
char_t const *  prefix,
int  offs,
int  indexMask,
int &  attr,
size_t &  dbsAlignment,
size_t &  appAlignment 
) [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
Parameters:
dbsAlignment maximal alignment of the fields in the database
appAlignment maximal alignment of the fields in the application
bool dbTableDescriptor::checkRelationship (  ) 

Check consuistency of declared realations (check that referenced table actually contains declared inverse reference field). This method also resolve references between table.

static void dbTableDescriptor::cleanup (  )  [static]

Remove all table descriptors except static ones

dbTableDescriptor* dbTableDescriptor::clone (  )  [protected]

Clone table descriptor

bool dbTableDescriptor::equal ( dbTable table,
bool  ignoreIndices = false 
)

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

Parameters:
table database table descriptor
ignoreIndices ignore presence of indices during comparison
Returns:
true if two table descriptors are equal
dbFieldDescriptor* dbTableDescriptor::find ( char_t const *  name  ) 

Find field with specified name

dbFieldDescriptor* dbTableDescriptor::findSymbol ( char_t const *  name  ) 

Find field with specified symbol name

dbDatabase* dbTableDescriptor::getDatabase (  )  [inline]

Get reference to associated database

Returns:
database to which this table is assigned
dbFieldDescriptor* dbTableDescriptor::getFirstField (  )  [inline]

Get first record field

Returns:
descriptor of first record field
oid_t dbTableDescriptor::getId (  )  [inline]

Get table identifier

int dbTableDescriptor::getLastValueOfAutoincrementCount (  )  const [inline]

Get last value of autoincrement counter used for this table

Returns:
last value of autoincrement counter used for this table
char_t* dbTableDescriptor::getName (  )  [inline]

Get table name.

dbFieldDescriptor* dbTableDescriptor::getNextField ( dbFieldDescriptor field  )  [inline]

Get next field

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

References dbFieldDescriptor::next.

dbTableDescriptor* dbTableDescriptor::getNextTable (  )  [inline]

Get next table in database

bool dbTableDescriptor::match ( dbTable table,
bool  confirmDeleteColumns,
bool  preserveExistedIndices,
bool  isEmpty 
)

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
preserveExistedIndices preserve existed indices
isEmpty table is empty
Returns:
true if no reformatting is needed
void dbTableDescriptor::setFlags (  ) 

Set fields flags. This method is called after loading table descriptor from database.

size_t dbTableDescriptor::size (  )  [inline]

Get size of instance of the class in an application

void dbTableDescriptor::storeInDatabase ( dbTable table  ) 

Save table descriptor in the database.

Parameters:
table place where to store table descriptor
size_t dbTableDescriptor::totalNamesLength (  )  [protected]

Calculate total length of all names in table descriptor


Member Data Documentation

size_t dbTableDescriptor::appSize [protected]

Size of tghe correspondent application object

int dbTableDescriptor::attr [protected]

Table attrbiutes

Autoincremented counter for this table

dbSelection dbTableDescriptor::batch [protected]

Selection to hold OID of batch inserted records

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.

Collision chain of table's hash table

List of table columns

Attached database

Referenced by dbDatabase::assign().

List of all fields

oid_t dbTableDescriptor::firstRow [protected]

Identifer of the first (oldest) row in the table

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

Referenced by dbDatabase::assign().

size_t dbTableDescriptor::fixedSize [protected]

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

List of hashed fields

List of fields indexed by B-Ttree

Initial value for autoincrement conunt

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

bool dbTableDescriptor::isInBatch [protected]

If table contains batch inserted records

bool dbTableDescriptor::isStatic [protected]

Table descriptor is static object created by one of REGISTER macros

oid_t dbTableDescriptor::lastRow [protected]

Identifer of the last (most recently inerted) row in the table

char_t* dbTableDescriptor::name [protected]

Name of the table

size_t dbTableDescriptor::nColumns [protected]

Number of columns in the table

Chain of all tables in application

Next table with batch inserted records

Chain of all tables associated with database

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

size_t dbTableDescriptor::nFields [protected]

Number of fields in the table

size_t dbTableDescriptor::nRows [protected]

Number of the rows in the table

oid_t dbTableDescriptor::tableId [protected]

Indetifier of table object in the database

Referenced by dbDatabase::assign().

ID of transaction when this table descriptor was last refreshed


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