dbFieldDescriptor Class Reference

#include <class.h>

List of all members.


Detailed Description

Descriptor of table field.

Public Types

enum  FieldAttributes {
  ComponentOfArray = 0x01,
  HasArrayComponents = 0x02,
  OneToOneMapping = 0x04,
  Updated = 0x08
}
 Attributes of the field. More...
enum  StoreMode {
  Insert,
  Update,
  Import
}

Public Member Functions

size_t calculateRecordSize (byte *base, size_t offs)
 Calculate record size in the database.
size_t calculateNewRecordSize (byte *base, size_t offs)
 Calculate record size after reformatting record according to the new definition of the application class.
size_t convertRecord (byte *dst, byte *src, size_t offs)
 Convert of the feild to new format.
int sizeWithoutOneField (dbFieldDescriptor *field, byte *base, size_t &size)
 Size of the record without one field.
size_t copyRecordExceptOneField (dbFieldDescriptor *field, byte *dst, byte *src, size_t offs)
 Recursively copy record to new location except one field.
size_t storeRecordFields (byte *dst, byte *src, size_t offs, StoreMode mode)
 Store record fields in the databases This method performs interation thtough all components in one scope and recursively invoke itself for structure and array components.
void markUpdatedFields (byte *dst, byte *src)
 Mask updated fields.
void fetchRecordFields (byte *dst, byte *src)
 Fetch record from the database This method performs interation thtough all components in one scope and recursively invoke itself for structure and array components.
void adjustReferences (byte *record, size_t base, size_t size, long shift)
 Adjust references in all fetched records (current records in all opened cursors) when database was reallocated.
dbFieldDescriptorfind (const char *name)
 Find component with specified name (for structures only).
dbFieldDescriptorgetFirstComponent ()
 Get first component of the field (for structures only).
dbFieldDescriptorgetNextComponent (dbFieldDescriptor *field)
 Get next component within the scope.
dbFieldDescriptoroperator, (dbFieldDescriptor &field)
 Redefined ',' operator used to form list of components.
void * operator new (size_t size EXTRA_DEBUG_NEW_PARAMS)
void operator delete (void *p EXTRA_DEBUG_NEW_PARAMS)
dbFieldDescriptoradjustOffsets (long offs)
 Adjust offsets within application objects for descriptors of base classes.
 dbFieldDescriptor (char const *name, size_t offs, size_t size, int indexType, char const *inverse=NULL, dbFieldDescriptor *components=NULL)
 Field descriptor constructor.
 dbFieldDescriptor (char const *name)
 Constructor of dummy field descriptor.
 ~dbFieldDescriptor ()
 Field descriptor destructor.

Public Attributes

dbFieldDescriptornext
 Next file within scope.
dbFieldDescriptorprev
 Previous field within scope.
dbFieldDescriptornextField
 Next field in the list of all fields in the table.
dbFieldDescriptornextHashedField
 Next field in the list of all hashed fields in the table.
dbFieldDescriptornextIndexedField
 Next field in the list of all indexed fields in the table.
dbFieldDescriptornextInverseField
 Next field in the list of all relation fields in the table.
int fieldNo
 Column number.
char * name
 Name of the field.
char * longName
 Compound name of field, for example "coord.x".
char * refTableName
 Name of referenced table (for reference fields only).
dbTableDescriptorrefTable
 Referenced table (for reference fields only).
dbTableDescriptordefTable
 Definition of the table to which this field belongs.
dbFieldDescriptorinverseRef
 Inverse reference (for reference fields only).
char * inverseRefName
 Inverse reference name (for reference fields only).
int type
 Type of the field in the database (dbField::FieldTypes).
int appType
 Type of the field in application.
int indexType
 Type of field index (bit combination of constants defined in dbIndexType).
int dbsOffs
 Offset to the field in database.
int appOffs
 Offset to the field in application.
dbFieldDescriptorcomponents
 Subcomponents of the field (for structures and arrays).
oid_t hashTable
 Hash table (for fields which are indexed by means of hash table).
oid_t tTree
 T-Tree (for fields which are indexed by means of T-Ttree).
size_t dbsSize
 Size of the record in database.
size_t appSize
 Size of the object in application.
size_t alignment
 Alignment of the field (for structures it is equal to the maximum required alignment of it's components.
dbUDTComparator comparator
 Comparator for user defined types.
int attr
int oldDbsType
 Old type of the field in database (before schema evaluation).
int oldDbsOffs
 Old offset of the field in database (before schema evaluation).
int oldDbsSize
 Old size of the field in database (before schema evaluation).
dbAnyMethodTrampolinemethod
 Trampoline used to invoke class method from SubSQL (for method components only).
void(* arrayAllocator )(dbAnyArray *array, void *data, size_t length)
 Allocator of array components.

Member Enumeration Documentation

Attributes of the field.

Enumerator:
ComponentOfArray 
HasArrayComponents 
OneToOneMapping 
Updated 

enum StoreMode

Enumerator:
Insert 
Update 
Import 


Constructor & Destructor Documentation

dbFieldDescriptor ( char const *  name,
size_t  offs,
size_t  size,
int  indexType,
char const *  inverse = NULL,
dbFieldDescriptor components = NULL 
)

Field descriptor constructor.

Parameters:
name name of the field
offs offset of the field
size size of the field
indexType type of index used for this field
inverse name of inverse field
components comopnents of structure or array

dbFieldDescriptor ( char const *  name  ) 

Constructor of dummy field descriptor.

Parameters:
name name of the field

Field descriptor destructor.


Member Function Documentation

size_t calculateRecordSize ( byte base,
size_t  offs 
)

Calculate record size in the database.

This method performs interation through all components in one scope and recursively invokes itself for structure and array components. First time this method is invoked by table descriptor with offs equal to size of fixed part of the record.

Parameters:
base address of the application object
offs offset of the end of varying part of the record
Returns:
size of the record

size_t calculateNewRecordSize ( byte base,
size_t  offs 
)

Calculate record size after reformatting record according to the new definition of the application class.

This method performs interation thtough all components in one scope and recursively invoke itself for structure and array components.

Parameters:
base address of the application object
offs offset of the end of varying part of the record
Returns:
size of the record

size_t convertRecord ( byte dst,
byte src,
size_t  offs 
)

Convert of the feild to new format.

This method is recursively invoked for array and structure components.

Parameters:
dst destination for converted field
src original field
offs offset of varying part
offs offset of the end of varying part of the record
Returns:
size of the record

int sizeWithoutOneField ( dbFieldDescriptor field,
byte base,
size_t &  size 
)

Size of the record without one field.

This method is used to implement automatically updated inverse references. This method performs interation thtough all components in one scope and recursively invoke itself for structure and array components.

Parameters:
field list of the fields in one scope
base pointer inside database
size [in/out] size of the record
Returns:
offset of last field

size_t copyRecordExceptOneField ( dbFieldDescriptor field,
byte dst,
byte src,
size_t  offs 
)

Recursively copy record to new location except one field.

This method is used for updating inverse references.

Parameters:
field list of the fields in one scope
dst destination where record should be copied
src source of the copy
offs offset to the end of varying part
Returns:
size of the record

size_t storeRecordFields ( byte dst,
byte src,
size_t  offs,
StoreMode  mode 
)

Store record fields in the databases This method performs interation thtough all components in one scope and recursively invoke itself for structure and array components.

Parameters:
dst place in the database where record should be stored
src pointer to the application object
offs offset to the end of varying part
insert flag used to distringuish update fro insert (needed for autoincremented fields)
Returns:
size of the record

void markUpdatedFields ( byte dst,
byte src 
)

Mask updated fields.

This method performs interation thtough all components in one scope and recursively invoke itself for structure and array components.

Parameters:
dst old image of the record in the database
src updated application object

void fetchRecordFields ( byte dst,
byte src 
)

Fetch record from the database This method performs interation thtough all components in one scope and recursively invoke itself for structure and array components.

Parameters:
dst pointer to the application object into which record is extract
src image of the object in the database

void adjustReferences ( byte record,
size_t  base,
size_t  size,
long  shift 
)

Adjust references in all fetched records (current records in all opened cursors) when database was reallocated.

Parameters:
record pointer to the application object which references should be adjusted
base new address of memory mapping
size database isze before extension
shift difference between old and new addresses of memory mapping obejct location.

dbFieldDescriptor * find ( const char *  name  ) 

Find component with specified name (for structures only).

Parameters:
name component name
Returns:
descriptor of the field or NULL if not found

dbFieldDescriptor* getFirstComponent (  )  [inline]

Get first component of the field (for structures only).

Returns:
first component of the structure

dbFieldDescriptor* getNextComponent ( dbFieldDescriptor field  )  [inline]

Get next component within the scope.

Returns:
next component within the scope

dbFieldDescriptor& operator, ( dbFieldDescriptor field  )  [inline]

Redefined ',' operator used to form list of components.

void * operator new ( size_t size  EXTRA_DEBUG_NEW_PARAMS  ) 

void operator delete ( void *p  EXTRA_DEBUG_NEW_PARAMS  ) 

dbFieldDescriptor & adjustOffsets ( long  offs  ) 

Adjust offsets within application objects for descriptors of base classes.


Member Data Documentation

Next file within scope.

Previous field within scope.

Next field in the list of all fields in the table.

Next field in the list of all hashed fields in the table.

Next field in the list of all indexed fields in the table.

Next field in the list of all relation fields in the table.

int fieldNo

Column number.

char* name

Name of the field.

char* longName

Compound name of field, for example "coord.x".

char* refTableName

Name of referenced table (for reference fields only).

Referenced table (for reference fields only).

Definition of the table to which this field belongs.

Inverse reference (for reference fields only).

Inverse reference name (for reference fields only).

int type

Type of the field in the database (dbField::FieldTypes).

int appType

Type of the field in application.

int indexType

Type of field index (bit combination of constants defined in dbIndexType).

int dbsOffs

Offset to the field in database.

int appOffs

Offset to the field in application.

Subcomponents of the field (for structures and arrays).

Hash table (for fields which are indexed by means of hash table).

T-Tree (for fields which are indexed by means of T-Ttree).

size_t dbsSize

Size of the record in database.

size_t appSize

Size of the object in application.

size_t alignment

Alignment of the field (for structures it is equal to the maximum required alignment of it's components.

Comparator for user defined types.

int attr

Old type of the field in database (before schema evaluation).

Old offset of the field in database (before schema evaluation).

Old size of the field in database (before schema evaluation).

Trampoline used to invoke class method from SubSQL (for method components only).

void(* arrayAllocator)(dbAnyArray *array, void *data, size_t length)

Allocator of array components.


Online Library Docs

sipXecs home page

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