Main Page | Class Hierarchy | Class List | File List | Class Members

dbDatabase Class Reference

#include <database.h>

List of all members.

Public Types

typedef void(* dbErrorHandler )(int error, char const *msg, int msgarg)
enum  DetachFlags { COMMIT = 1, DESTROY_CONTEXT = 2 }
enum  dbErrorClass {
  NoError, QueryError, ArithmeticError, IndexOutOfRangeError,
  DatabaseOpenError, FileError, OutOfMemoryError, Deadlock,
  NullReferenceError, LockRevoked, FileLimitExeeded, InconsistentInverseReference,
  DatabaseReadOnly
}
enum  dbAccessType { dbReadOnly = 0, dbAllAccess = 1, dbConcurrentRead = 2, dbConcurrentUpdate = 3 }

Public Member Functions

bool open (char const *databaseName, char const *fileName=NULL, time_t waitLockTimeoutMsec=INFINITE, time_t commitDelaySec=0)
void close ()
void commit ()
void precommit ()
void rollback ()
void scheduleBackup (char const *fileName, time_t periodSec)
void attach ()
void detach (int flags=COMMIT|DESTROY_CONTEXT)
void lock ()
bool backup (char const *file, bool compactify)
void assign (dbTableDescriptor &desc)
void setConcurrency (unsigned nThreads)
long getAllocatedSize ()
long getDatabaseSize ()
int getNumberOfReaders ()
int getNumberOfWriters ()
int getNumberOfBlockedReaders ()
int getNumberOfBlockedWriters ()
int getNumberOfUsers ()
void allowColumnsDeletion (bool enabled=true)
dbErrorHandler setErrorHandler (dbErrorHandler newHandler)
virtual void handleError (dbErrorClass error, char const *msg=NULL, int arg=0)
void insertRecord (dbTableDescriptor *table, dbAnyReference *ref, void const *record)
bool isOpen () const
int getVersion ()
void setFileSizeLimit (size_t limit)
template<class T> dbReference< T > insert (T const &record)
dbTableDescriptorlookupTable (dbTableDescriptor *desc)
 dbDatabase (dbAccessType type=dbAllAccess, size_t dbInitSize=dbDefaultInitDatabaseSize, size_t dbExtensionQuantum=dbDefaultExtensionQuantum, size_t dbInitIndexSize=dbDefaultInitIndexSize, int nThreads=1)
virtual ~dbDatabase ()

Public Attributes

const dbAccessType accessType
const size_t initSize
const size_t extensionQuantum
const size_t initIndexSize

Static Public Attributes

unsigned dbParallelScanThreshold

Protected Types

enum  dbLockType { dbSharedLock, dbExclusiveLock, dbCommitLock }

Protected Member Functions

void delayedCommit ()
void backupScheduler ()
void commit (dbDatabaseThreadContext *ctx)
void restoreTablesConsistency ()
dbRecordgetRow (oid_t oid)
dbRecordputRow (oid_t oid, size_t newSize)
dbRecordputRow (oid_t oid)
byte * get (oid_t oid)
byte * put (oid_t oid)
bool isIndexApplicable (dbAnyCursor *cursor, dbExprNode *expr, dbExprNode *andExpr, dbFieldDescriptor *&indexedField)
bool isIndexApplicable (dbAnyCursor *cursor, dbExprNode *expr, dbExprNode *andExpr)
bool followInverseReference (dbExprNode *expr, dbExprNode *andExpr, dbAnyCursor *cursor, oid_t iref)
bool existsInverseReference (dbExprNode *expr, int nExistsClauses)
bool evaluate (dbExprNode *expr, oid_t oid, dbTable *table, dbAnyCursor *cursor)
void select (dbAnyCursor *cursor)
void select (dbAnyCursor *cursor, dbQuery &query)
void traverse (dbAnyCursor *cursor, dbQuery &query)
void update (oid_t oid, dbTableDescriptor *table, void const *record)
void remove (dbTableDescriptor *table, oid_t oid)
offs_t allocate (size_t size, oid_t oid=0)
void deallocate (offs_t pos, size_t size)
void extend (offs_t size)
void cloneBitmap (offs_t pos, size_t size)
oid_t allocateId (int n=1)
void freeId (oid_t oid, int n=1)
void updateCursors (oid_t oid, bool removed=false)
void recovery ()
bool checkVersion ()
oid_t allocateObject (dbInternalObject marker)
oid_t allocateRow (oid_t tableId, size_t size)
void allocateRow (oid_t tableId, oid_t oid, size_t size)
void freeRow (oid_t tableId, oid_t oid)
void freeObject (oid_t oid)
bool beginTransaction (dbLockType)
void endTransaction ()
void endTransaction (dbDatabaseThreadContext *ctx)
void initializeMetaTable ()
bool loadScheme (bool alter)
bool completeDescriptorsInitialization ()
void reformatTable (oid_t tableId, dbTableDescriptor *desc)
bool addIndices (bool alter, dbTableDescriptor *desc)
oid_t addNewTable (dbTableDescriptor *desc)
void updateTableDescriptor (dbTableDescriptor *desc, oid_t tableId)
void insertInverseReference (dbFieldDescriptor *fd, oid_t reverseId, oid_t targetId)
void removeInverseReferences (dbTableDescriptor *desc, oid_t oid)
void removeInverseReference (dbFieldDescriptor *fd, oid_t reverseId, oid_t targetId)
void deleteTable (dbTableDescriptor *desc)
void dropTable (dbTableDescriptor *desc)
void createIndex (dbFieldDescriptor *fd)
void createHashTable (dbFieldDescriptor *fd)
void dropIndex (dbFieldDescriptor *fd)
void dropHashTable (dbFieldDescriptor *fd)
void linkTable (dbTableDescriptor *table, oid_t tableId)
void unlinkTable (dbTableDescriptor *table)
bool wasReserved (offs_t pos, size_t size)
void reserveLocation (dbLocation &location, offs_t pos, size_t size)
void commitLocation ()
dbTableDescriptorfindTable (char const *name)
dbTableDescriptorfindTableByName (char const *name)
dbTableDescriptorgetTables ()
void setDirty ()

Static Protected Member Functions

void thread_proc delayedCommitProc (void *arg)
void thread_proc backupSchedulerProc (void *arg)
void _fastcall execute (dbExprNode *expr, dbInheritedAttribute &iattr, dbSynthesizedAttribute &sattr)
void deleteCompiledQuery (dbExprNode *tree)

Protected Attributes

dbThreadPool threadPool
dbThreadContext< dbDatabaseThreadContext > threadContext
byte * baseAddr
dbHeaderheader
offs_t * currIndex
offs_t * index [2]
unsigned parThreads
bool modified
size_t currRBitmapPage
size_t currRBitmapOffs
size_t currPBitmapPage
size_t currPBitmapOffs
dbLocation * reservedChain
char * databaseName
int databaseNameLen
char * fileName
int version
size_t mmapSize
size_t committedIndexSize
size_t currIndexSize
oid_t updatedRecordId
unsigned dbWaitLockTimeout
size_t dbFileSizeLimit
bool uncommittedChanges
dbFile file
dbSharedObject< dbMonitor > shm
dbGlobalCriticalSection cs
dbGlobalCriticalSection mutatorCS
dbInitializationMutex initMutex
dbSemaphore writeSem
dbSemaphore readSem
dbSemaphore upgradeSem
dbEvent backupCompletedEvent
dbMonitor * monitor
dbTableDescriptortables
int * bitmapPageAvailableSpace
bool opened
long allocatedSize
time_t commitDelay
time_t commitTimeout
time_t commitTimerStarted
dbMutex delayedCommitStartTimerMutex
dbMutex delayedCommitStopTimerMutex
dbLocalEvent delayedCommitStartTimerEvent
dbEvent delayedCommitStopTimerEvent
dbLocalEvent commitThreadSyncEvent
dbMutex backupMutex
dbLocalEvent backupInitEvent
char * backupFileName
time_t backupPeriod
bool stopDelayedCommitThread
dbThread backupThread
dbThread commitThread
int accessCount
dbL2List threadContextList
dbMutex threadContextListMutex
dbErrorHandler errorHandler
int schemeVersion
dbVisitedObject * visitedChain
bool confirmDeleteColumns

Static Protected Attributes

size_t internalObjectSize []

Friends

class dbSelection
class dbAnyCursor
class dbHashTable
class dbQuery
class dbTtree
class dbTtreeNode
class dbParallelQueryContext
class dbServer
class dbColumnBinding
class dbUserFunctionArgument
class dbAnyContainer
class dbFile
class dbCLI
class GiSTdb
class dbHArray


Detailed Description

Database class


Member Enumeration Documentation

enum dbDatabase::dbLockType [protected]
 

Start database transaction

Parameters:
modify if it is update or read-only rtansaction
Returns:
true if version of memory mapping object is not obsolete and reallocation is not possible


Constructor & Destructor Documentation

dbDatabase::dbDatabase dbAccessType  type = dbAllAccess,
size_t  dbInitSize = dbDefaultInitDatabaseSize,
size_t  dbExtensionQuantum = dbDefaultExtensionQuantum,
size_t  dbInitIndexSize = dbDefaultInitIndexSize,
int  nThreads = 1
 

Database constructor

Parameters:
type access type: dbDatabase::dbReadOnly or dbDatabase::dbAllAcces
dbInitSize initial size of the database. If FastDB is compiled with DISKLESS_CONFIGURATION option, then in this parameter MAXIMAL size of the database should be specified (in this mode database can not be reallocated)
dbExtensionQuantum quentum for extending memory allocation bitmap
dbInitIndexSize initial index size (objects)
nThreads concurrency level for sequential search and sort operations
See also:
setConcurrency(unsigned nThreads)

virtual dbDatabase::~dbDatabase  )  [virtual]
 

Database detructor


Member Function Documentation

bool dbDatabase::addIndices bool  alter,
dbTableDescriptor desc
[protected]
 

Add new indices to the table.

Parameters:
alter if true than indices can be added, otherwise there are some other active clients and adding new indices about which they will not know can lead to inconsistncy
desc new table descriptor
Returns:
true if indices were succesfully added

oid_t dbDatabase::addNewTable dbTableDescriptor desc  )  [protected]
 

Add new table to the database

Parameters:
desc - descriptor of new table
Returns:
oid of created table descriptor record

offs_t dbDatabase::allocate size_t  size,
oid_t  oid = 0
[protected]
 

Allocate object in the database e

Parameters:
size size of alocated object
oid if oid is not 0, then allocated region position is stored in correcpondent cell of object index (needed for allocation of bitmap pages)
Returns:
position of allcoated region

oid_t dbDatabase::allocateId int  n = 1  )  [protected]
 

Allocate object identifier(s)

Parameters:
number of allocated object indentifiers
Returns:
object idenitifer (in case if n greater than 1, all n subsequent OIDs are allocated and first one is returned

oid_t dbDatabase::allocateObject dbInternalObject  marker  )  [inline, protected]
 

Allocate internal object

Parameters:
market internal object tag
Returns:
oid of allocated object

void dbDatabase::allocateRow oid_t  tableId,
oid_t  oid,
size_t  size
[protected]
 

Allocate record with specified OID

Parameters:
tableId object identifier of the table
oid record OID
size size of the created record as table descriptor in the database

oid_t dbDatabase::allocateRow oid_t  tableId,
size_t  size
[inline, protected]
 

Allocate record

Parameters:
tableId object identifier of the table
size size of the created record as table descriptor in the database

void dbDatabase::allowColumnsDeletion bool  enabled = true  )  [inline]
 

Enable deletion of columns from the table when correspondent fields are renamed from class descriptor. By default it is switched of and database allows to delete fields only from empty table (to prevent unindented loose of data).

Parameters:
enabled true to enable column deletion in non empty tables

void dbDatabase::assign dbTableDescriptor desc  )  [inline]
 

Assign table to the database

Parameters:
desc table descriptor

void dbDatabase::attach  ) 
 

Attach current thread to the database. This method should be executed for all threads except one which opened the database.

bool dbDatabase::backup char const *  file,
bool  compactify
 

Perform backup to the specified file

Parameters:
file path to the backup file
comactify if true then databae will be compactificated during backup - i.e. all used objects will be placed together without holes; if false then backup is performed by just writting memory mapped object to the backup file.
Returns:
whether backup was succeseful or not

bool dbDatabase::checkVersion  )  [protected]
 

Check if program works with correct version of memory mapped object (if memory mapped object is reallocated by some client, its version number is incremented, so all other client will be able to notice it and also reallocate their memory mapping objects.

Returns:
true if memory mapping object was successfully reallocated or no reallocation is needed at all

void dbDatabase::cloneBitmap offs_t  pos,
size_t  size
[protected]
 

Clone memory allocation bitmap for region [pos, pos+size)

Parameters:
pos start of region
size size of region

void dbDatabase::close  ) 
 

Close database

void dbDatabase::commit dbDatabaseThreadContext *  ctx  )  [protected]
 

Commit transaction

Parameters:
ctx thread context

void dbDatabase::commit  ) 
 

Commit transaction

void dbDatabase::commitLocation  )  [protected]
 

Remove location from list of reserved locations. It is done after location is marked as occupied in bitmap.

bool dbDatabase::completeDescriptorsInitialization  )  [protected]
 

This method is invoked by SubSQL to complete table descriptors initialization after loading of all table descriptoes from thr database

Returns:
true if intertable relation consuistency is rpeservedm false otherwise

void dbDatabase::createHashTable dbFieldDescriptor fd  )  [protected]
 

Create hash table for the field

Parameters:
fd field descriptor

void dbDatabase::createIndex dbFieldDescriptor fd  )  [protected]
 

Create T-Tree index for the field

Parameters:
fd field descriptor

void dbDatabase::deallocate offs_t  pos,
size_t  size
[protected]
 

Deallocate region

Parameters:
pos start position of region
size of region

void dbDatabase::deleteCompiledQuery dbExprNode *  tree  )  [static, protected]
 

Cleanup compiled query

void dbDatabase::deleteTable dbTableDescriptor desc  )  [protected]
 

Delete table from the database

Parameters:
desc table descriptor

void dbDatabase::detach int  flags = COMMIT|DESTROY_CONTEXT  ) 
 

Detach thread from the database.

Parameters:
flags mask of DetachFlags COMMIT and DESTROY_CONTEXT

void dbDatabase::dropHashTable dbFieldDescriptor fd  )  [protected]
 

Drop hash table for the field

Parameters:
fd field descriptor

void dbDatabase::dropIndex dbFieldDescriptor fd  )  [protected]
 

Drop T-Tree index for the field

Parameters:
fd field descriptor

void dbDatabase::dropTable dbTableDescriptor desc  )  [protected]
 

Delete all table records

Parameters:
desc table descriptor

void dbDatabase::endTransaction dbDatabaseThreadContext *  ctx  )  [protected]
 

End transaction with specified thread context

Parameters:
ctx thread context

void dbDatabase::endTransaction  )  [inline, protected]
 

End transaction

bool dbDatabase::evaluate dbExprNode *  expr,
oid_t  oid,
dbTable table,
dbAnyCursor cursor
[protected]
 

Evaluate epression. This method initialie initiainherited attributes and invoke execute method

Parameters:
expr expression to be evaluated
oid OID of the inspected record
seaqched table
cursor result set
Returns:
true if this record match search condition, false otherwise

void _fastcall dbDatabase::execute dbExprNode *  expr,
dbInheritedAttribute &  iattr,
dbSynthesizedAttribute &  sattr
[static, protected]
 

Execute expression. This method is most frequently recursivly called during evaluation of search predicate.

Parameters:
expr expression to be executed
iattr inherited attributes - attributes passed top-down (information like cursor, current record, ...)
sattr synthesized attribute - sttributes passed down-top (value of expression)

bool dbDatabase::existsInverseReference dbExprNode *  expr,
int  nExistsClauses
[protected]
 

Check if there is inverse reference in the table rerefrenced from search predicate.

Parameters:
expr evaluated expression
nExistsClause number of exists clauses in search wrapping this expression
Returns:
true if inverse reference(s) exists and it is possible to perform backward traversal

void dbDatabase::extend offs_t  size  )  [protected]
 

Checks whther allocated size is greater than size of databae file and recreate memory mapping object with larger size n the last case

Parameters:
size allocated size

dbTableDescriptor* dbDatabase::findTable char const *  name  )  [protected]
 

Find table using symbol name

Parameters:
name symbol table entry (returned by dbSymbolTable::add method)
Returns:
table descriptor or NULL if not found

dbTableDescriptor* dbDatabase::findTableByName char const *  name  )  [protected]
 

Find table by name. This method get symbol for specified name and call findTable method.

Parameters:
name name of table
Returns:
table descriptor or NULL if not found

bool dbDatabase::followInverseReference dbExprNode *  expr,
dbExprNode *  andExpr,
dbAnyCursor cursor,
oid_t  iref
[protected]
 

If query predicate contains operands from other tables (accessed by references) and inverse references exists, then FastDB performs indexed search in referenced table and then go back using inverse referenced to query table. followInverseReference method performs this backward traversal of inverse references.

Parameters:
expr evaluated expression
andExpr if not null, then it is used as filter to all records selected by index search
cursor cursor to collect selected records
iref OID of the selected records in referenced table

void dbDatabase::freeId oid_t  oid,
int  n = 1
[protected]
 

Free object identifier(s)

Parameters:
oid deallocated object identifer (or first of n deallocated subsequent identifiers if n greater than 1)
number of allocated object indentifiers

void dbDatabase::freeObject oid_t  oid  )  [protected]
 

Free internal object

void dbDatabase::freeRow oid_t  tableId,
oid_t  oid
[protected]
 

Delete row from the table

Parameters:
tableId OID of record with table descriptor
oid identifier of deleted record

byte* dbDatabase::get oid_t  oid  )  [inline, protected]
 

Get record by OID

Parameters:
oid object identifier
Returns:
pointer to the record inside database

long dbDatabase::getAllocatedSize  )  [inline]
 

Get size allocated in the database since open

Returns:
delta between size of allocated and deallocated data

long dbDatabase::getDatabaseSize  )  [inline]
 

Get size of the database file

Returns:
database file size

int dbDatabase::getNumberOfBlockedReaders  )  [inline]
 

Get number of threads blocked while starting read-only transaction

Returns:
number of threads which shared lock request was blocked

int dbDatabase::getNumberOfBlockedWriters  )  [inline]
 

Get number of threads blocked while starting update transaction

Returns:
number of threads which exclusive lock request was blocked

int dbDatabase::getNumberOfReaders  )  [inline]
 

Get number of threads accessing database in shared mode (readonly)

Returns:
number of granted shared locks

int dbDatabase::getNumberOfUsers  )  [inline]
 

Get number of processes attached to the database

Returns:
number of processes openned the database

int dbDatabase::getNumberOfWriters  )  [inline]
 

Get number of threads accessing database in exclusiveh mode (for update)

Returns:
number of granted exclusive locks (can be either 0 either 1)

dbRecord* dbDatabase::getRow oid_t  oid  )  [inline, protected]
 

Get table row

Parameters:
oid object indentifier
Returns:
object with this oid

dbTableDescriptor* dbDatabase::getTables  )  [protected]
 

Get list of tables attached to the database

Returns:
list of tables attached to the database

int dbDatabase::getVersion  ) 
 

Get database version

virtual void dbDatabase::handleError dbErrorClass  error,
char const *  msg = NULL,
int  arg = 0
[virtual]
 

Error handler. It can be redifined by application to implement application specific error handling.

Parameters:
error class of the error
msg error message
arg optional argument

void dbDatabase::initializeMetaTable  )  [protected]
 

Initialize database metatable (table containning information about all other tables included metatable itself). This method is invoked during database initialzation.

template<class T>
dbReference<T> dbDatabase::insert T const &  record  )  [inline]
 

Insert record in the database

Parameters:
record transient object to be insrted in the database
Returns:
reference to the created object

void dbDatabase::insertInverseReference dbFieldDescriptor fd,
oid_t  reverseId,
oid_t  targetId
[protected]
 

Insert inverse reference. When reference or array of reference which is part of relation is updated then reference to the updated record is inserted in inverse reference field of all new referenced records (which were not referenced by this field before update).

Parameters:
fd descriptor of updated field (inverse reference should exist for this field)
reverseId OID of updated record
targetId OID of record referenced by this field

void dbDatabase::insertRecord dbTableDescriptor table,
dbAnyReference ref,
void const *  record
 

Insert record in the database

Parameters:
table table descriptor
ref [out] pointer to the references where ID of created object will be stored
record pointer to the transient object to be inserted in the table

bool dbDatabase::isIndexApplicable dbAnyCursor cursor,
dbExprNode *  expr,
dbExprNode *  andExpr
[protected]
 

Check whether expression can be evaluated unsing index. If index is applicable, than index search is performed and result is stored in the cursor.

Parameters:
cursor result set
expr evaluated expression
andExpr if not null, then it is used as filter to all records selected by index search
Returns:
true if expression was evaluated using index, false if index is not applicable and sequential search is required

bool dbDatabase::isIndexApplicable dbAnyCursor cursor,
dbExprNode *  expr,
dbExprNode *  andExpr,
dbFieldDescriptor *&  indexedField
[protected]
 

Check whether search dan be performed using indices

Parameters:
expr evaluated expression
andExpr if not null, then it is used as filter to all records selected by index search
indexedFile [out] used to return information about which field was used to perfrom index search and so order in which selected records are sorted. If this order is the same as requested by "order by" clause, then no extra sorting is needed.
Returns:
true if search was performed using indeices, false if index is not applicable and sequential search is required

bool dbDatabase::isOpen  )  const [inline]
 

Check if database is opened

void dbDatabase::linkTable dbTableDescriptor table,
oid_t  tableId
[protected]
 

Link table to the database table list

Parameters:
table table descriptor
tableId OID of record containing database table descriptor

bool dbDatabase::loadScheme bool  alter  )  [protected]
 

Load database scheme. This method loads table decriptors from database, compare them with application classes, do necessary reformatting and save update andnew table decriptor in database

Parameters:
alter if true then schema can be altered, otherwise there are some other active clients working with this database so schema can not be altered

void dbDatabase::lock  )  [inline]
 

Exclusivly lock the database.

dbTableDescriptor* dbDatabase::lookupTable dbTableDescriptor desc  ) 
 

Find cloned table desciptor assigned to this database

Parameters:
des static unassigned table descriptor
Returns:
clone of this table descriptor assigned to this databae or NULL if not found.

bool dbDatabase::open char const *  databaseName,
char const *  fileName = NULL,
time_t  waitLockTimeoutMsec = INFINITE,
time_t  commitDelaySec = 0
 

Open database

Parameters:
databaseName database name
fielName path to the database file (if null, then file name daatbaseName + ".fdb" will be used)
waitLockTimeoutMsec timeout for waiting locks, by default disabled
commitDelaySec delayed commit timeout, by default disabled
Returns:
true if database was successfully opened

void dbDatabase::precommit  ) 
 

Release all locks hold by transaction allowing other clients to proceed but do not flush changes to the disk

byte* dbDatabase::put oid_t  oid  )  [inline, protected]
 

Prepare for update of internal object.

Parameters:
oid internal object identifier
Returns:
pointer to the record inside database

dbRecord* dbDatabase::putRow oid_t  oid  )  [inline, protected]
 

Prepare for object update ithout changing its size

Parameters:
oid object indetifier
Returns:
pointer inside database where object should should be stored

dbRecord* dbDatabase::putRow oid_t  oid,
size_t  newSize
[protected]
 

Prepare for row insertion or update. If record with such OID not exists or it is first time when it was changed during this transaction or size of recrod is changed, than new record is alocated in the database. Otherwisepointer to existed recordis returned.

Parameters:
oid object indetifier
newSize size of new object
Returns:
pointer inside database where object should should be stored

void dbDatabase::recovery  )  [protected]
 

Perform database recovery after fault

void dbDatabase::reformatTable oid_t  tableId,
dbTableDescriptor desc
[protected]
 

Reformat table according to new format

Parameters:
tableId OID of changed tables
nw table descriptor

void dbDatabase::remove dbTableDescriptor table,
oid_t  oid
[protected]
 

Remove record from the database

Parameters:
table descriptor of the table to which record belongs
oid record identifier

void dbDatabase::removeInverseReference dbFieldDescriptor fd,
oid_t  reverseId,
oid_t  targetId
[protected]
 

Remove inverse reference. When reference or array of reference which is part of relation is updated then reference to the updated record is removed from inverse reference field of all referenced records which are not reference any more from by this field.

Parameters:
fd descriptor of updated field (inverse reference should exist for this field)
reverseId OID of updated record
targetId OID of record referenced by this field

void dbDatabase::removeInverseReferences dbTableDescriptor desc,
oid_t  oid
[protected]
 

Remove inverse references to the removed record

Parameters:
desc descriptor of table from which record is removed
oid OID of removed record

void dbDatabase::reserveLocation dbLocation &  location,
offs_t  pos,
size_t  size
[protected]
 

Mark location as reserved. This method is used by allocator to protect hole located in memory allocation bitmap, from been used by recursuve call of allocator (needed to clone bitmap pages).

Parameters:
location [out] local structure describing location.
pos start position of the location
size location size

void dbDatabase::restoreTablesConsistency  )  [protected]
 

Restore consistency of table list of rows (last record should contain null reference in next field). This method is used during recovery after crash and during rollback.

void dbDatabase::rollback  ) 
 

Rollback transaction

void dbDatabase::scheduleBackup char const *  fileName,
time_t  periodSec
 

Schedule backup

Parameters:
fileName path to backup file. If name ends with '?', then each backup willbe placed in seprate file with '?' replaced with current timestamp
periodSec preiod of performing backups in seconds

void dbDatabase::select dbAnyCursor cursor,
dbQuery query
[protected]
 

Execute select query

Parameters:
cursor result set
query query expression

void dbDatabase::select dbAnyCursor cursor  )  [protected]
 

Select all records from the table

Parameters:
cursor result set

void dbDatabase::setConcurrency unsigned  nThreads  ) 
 

Set concurrency level for sequential search and sort operations. By default, FastDB tries to detect number of CPUs in system and create the same number of threads.

Parameters:
nThreads maximal number of threads to be created for perfroming cincurrent sequential search and sorting.

void dbDatabase::setDirty  )  [protected]
 

Mark database as been modified

dbErrorHandler dbDatabase::setErrorHandler dbErrorHandler  newHandler  ) 
 

Set error handler. Handler should be no-return function which perform stack unwind.

Parameters:
newHandler new error handler
Returns:
previous handler

void dbDatabase::setFileSizeLimit size_t  limit  )  [inline]
 

Specify database file size limit. Attempt to exeed this limit cause database error.

Parameters:
limit maximal file size in bytes

void dbDatabase::traverse dbAnyCursor cursor,
dbQuery query
[protected]
 

Perform table traverse: execute queries with "start from (follow by)" clause

Parameters:
cursor result set
query query expression

void dbDatabase::unlinkTable dbTableDescriptor table  )  [protected]
 

Unlink table from the database tables list

Parameters:
table table descriptor

void dbDatabase::update oid_t  oid,
dbTableDescriptor table,
void const *  record
[protected]
 

Update record

Parameters:
oid record identifier
table descriptor of the table to which record belongs
record updated image of the record

void dbDatabase::updateCursors oid_t  oid,
bool  removed = false
[protected]
 

Update record in in all active cursors if it this record is checnged in the database

Parameters:
oid object indentifier of checnged record
removed true if record was removed

void dbDatabase::updateTableDescriptor dbTableDescriptor desc,
oid_t  tableId
[protected]
 

Update database table descriptor

Parameters:
desc application table descriptor
tableId OID of recrods with database table descriptor

bool dbDatabase::wasReserved offs_t  pos,
size_t  size
[protected]
 

Check if location is reserved

Parameters:
pos start position of the location
size location size
Returns:
true id location was reserved


The documentation for this class was generated from the following file:
Generated on Thu Feb 12 13:04:48 2004 for FastDB by doxygen 1.3.5