Public Types | Public Member Functions | Public Attributes

dbFieldDescriptor Class Reference

#include <class.h>

List of all members.

Public Types

enum  FieldAttributes {
  ComponentOfArray = 0x01, HasArrayComponents = 0x02, OneToOneMapping = 0x04, Updated = 0x08,
  HasArrayOfArrayComponents = 0x10
}
enum  StoreMode { Insert, Update, Import }

Public Member Functions

size_t calculateRecordSize (byte *base, size_t offs)
size_t calculateNewRecordSize (byte *base, size_t offs)
size_t convertRecord (byte *dst, byte *src, size_t offs)
int sizeWithoutOneField (dbFieldDescriptor *field, byte *base, size_t &size)
size_t copyRecordExceptOneField (dbFieldDescriptor *field, byte *dst, byte *src, size_t offs)
size_t storeRecordFields (byte *dst, byte *src, size_t offs, StoreMode mode)
void markUpdatedFields (byte *dst, byte *src)
void markUpdatedFields2 (byte *dst, byte *src)
void fetchRecordFields (byte *dst, byte *src)
dbFieldDescriptorfindSymbol (const char_t *name)
dbFieldDescriptorfind (const char_t *name)
dbFieldDescriptorgetFirstComponent ()
dbFieldDescriptorgetNextComponent (dbFieldDescriptor *field)
dbFieldDescriptoroperator, (dbFieldDescriptor &field)
void * operator new (size_t size)
void operator delete (void *p)
dbFieldDescriptoradjustOffsets (size_t offs)
 dbFieldDescriptor (char_t const *name, size_t offs, size_t size, int indexType, char_t const *inverse=NULL, dbFieldDescriptor *components=NULL)
 dbFieldDescriptor (char_t const *name)
 ~dbFieldDescriptor ()

Public Attributes

dbFieldDescriptornext
dbFieldDescriptorprev
dbFieldDescriptornextField
dbFieldDescriptornextHashedField
dbFieldDescriptornextIndexedField
dbFieldDescriptornextInverseField
int fieldNo
char_t * name
char_t * longName
char_t * refTableName
dbTableDescriptorrefTable
dbTableDescriptordefTable
dbFieldDescriptorinverseRef
char_t * inverseRefName
int type
int appType
int indexType
union {
   bool   Bool
   int1   Int1
   int2   Int2
   int4   Int4
   db_int8   Db_Int8
   real4   Real4
   real8   Real8
defaultValue
int dbsOffs
int appOffs
dbFieldDescriptorcomponents
oid_t hashTable
oid_t bTree
size_t dbsSize
size_t appSize
size_t alignment
dbUDTComparator comparator
int attr
int oldDbsType
int oldDbsOffs
int oldDbsSize
dbAnyMethodTrampolinemethod
void(* arrayAllocator )(dbAnyArray *array, void *data, size_t length)

Detailed Description

Descriptor of table field


Member Enumeration Documentation

Attributes of the field


Constructor & Destructor Documentation

dbFieldDescriptor::dbFieldDescriptor ( char_t const *  name,
size_t  offs,
size_t  size,
int  indexType,
char_t 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::dbFieldDescriptor ( char_t const *  name  ) 

Constructor of dummy field descriptor

Parameters:
name name of the field
dbFieldDescriptor::~dbFieldDescriptor (  ) 

Field descriptor destructor


Member Function Documentation

dbFieldDescriptor& dbFieldDescriptor::adjustOffsets ( size_t  offs  ) 

Adjust offsets within application objects for descriptors of base classes.

size_t dbFieldDescriptor::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 dbFieldDescriptor::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 dbFieldDescriptor::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
size_t dbFieldDescriptor::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
void dbFieldDescriptor::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

Referenced by dbMethodTrampoline< T, R >::invoke().

dbFieldDescriptor* dbFieldDescriptor::find ( const char_t *  name  ) 

Find component with specified name (for structures only)

Parameters:
name component name
Returns:
descriptor of the field or NULL if not found
dbFieldDescriptor* dbFieldDescriptor::findSymbol ( const char_t *  name  ) 

Find component with specified symbol name (for structures only)

Parameters:
name component symbol name
Returns:
descriptor of the field or NULL if not found
dbFieldDescriptor* dbFieldDescriptor::getFirstComponent (  )  [inline]

Get first component of the field (for structures only)

Returns:
first component of the structure
dbFieldDescriptor* dbFieldDescriptor::getNextComponent ( dbFieldDescriptor field  )  [inline]

Get next component within the scope

Returns:
next component within the scope

References next.

void dbFieldDescriptor::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 dbFieldDescriptor::markUpdatedFields2 ( 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 new image of the record in the database
dbFieldDescriptor& dbFieldDescriptor::operator, ( dbFieldDescriptor field  )  [inline]

Redefined ',' operator used to form list of components

References next, and prev.

int dbFieldDescriptor::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 dbFieldDescriptor::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
mode Insert, Update or Import mode
Returns:
size of the record

Member Data Documentation

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

Offset to the field in application

Size of the object in application

Type of the field in application

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

Allocator of array components

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

Comparator for user defined types

Subcomponents of the field (for structures and arrays)

Referenced by dbMethodTrampoline< T, R >::invoke().

Offset to the field in database

Size of the record in database

Default value of the field (in case an existing scheme is extended)

Definition of the table to which this field belongs

Column number

Hash table (currently not used)

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

Inverse reference (for reference fields only)

Inverse reference name (for reference fields only)

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

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

Name of the field

Next file within scope

Referenced by getNextComponent(), dbTableDescriptor::getNextField(), and operator,().

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

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

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

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

Previous field within scope

Referenced by operator,().

Referenced table (for reference fields only)

Name of referenced table (for reference fields only)

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


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