Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

dbConnect_ctree Class Reference
[OOFILE Database backend for Faircom's ctree-Plus ISAM engine.]

#include <oofctree.h>

Inheritance diagram for dbConnect_ctree:

Inheritance graph
[legend]
Collaboration diagram for dbConnect_ctree:

Collaboration graph
[legend]
List of all members.

Detailed Description

Connection that manufactures OOF_ctreeBackend backends.

Works with either a single c-tree superfile or group of files in a directory.


interchange with OOF_ctreeBackend

void blobsHaveBeenFound ()
long allocBlobFilNo ()
void activateConnection ()

c-tree status (access to global variables)

short uerr_cod () const
short sysiocod () const
short isam_err () const

locking

virtual void exitLocking ()
virtual void enterWriteLocking ()
virtual void enterReadLocking ()

Public Types

enum  eLockingStates { noLocking, readLocking, writeLocking }

Public Member Functions

 dbConnect_ctree (bool isTemporary=false)
virtual ~dbConnect_ctree ()
virtual void newConnection (const char *connectionName)
virtual void openConnection (const char *connectionName)
virtual bool openOrCreateConnection (const char *connectionName)
void buildConnectionSchemaFromFile (const char *connectionName)
virtual void writeOOFSchema ()
 Write an OOFILE schema into a ctree resource.

virtual void newConnection (const FSSpec &)
virtual void openConnection (const FSSpec &)
virtual void close ()
virtual void deleteStorage ()
virtual bool usesSeparateStorageFiles () const
void useSeparateFiles ()
void useExclusiveAccess ()
bool isReadLocked () const
bool isWriteLocked () const
void resetLocks ()
OOF_String makeTableName (const char *) const
virtual oofString name () const
void gotoDatabaseDir () const
oofDirectorydatabaseDirectory () const
const oofStringconnectionName () const
void attachTable (dbTable *)
dbTabletable (unsigned int) const
dbTabletable (const char *)
unsigned int numTables () const
bool isOpen () const
bool inDeclarativePhase () const
 Connection has been declared but not opened or created.

virtual void describe (std::ostream &) const
 Provide human-readable information about object.

virtual void readOOFSchema (const oofString &schemaFileName)
 Reads & parses oofSchema from the file schemaFileName.

virtual void stats (std::ostream &)
void dumpData (std::ostream &)
void extract (std::ostream &os)
void copyAllFrom (dbConnect *)
void deleteAll ()
void generateTestData (unsigned long maxRecs=10000, bool generateRandom=true, unsigned long seedOrCount=0)
void schemaFileExt (const oofString &)
void suspendSorting () const
void resumeSorting () const
oofWordParsergetDefaultWordParser ()
void setDefaultWordParser (oofWordParser *inParser)
bool hidden () const
void hide (bool hideIt=true)

Static Public Member Functions

dbConnectcurrentlyConstructing ()
bool fileExists (const char *fName)
bool underConstruction ()
void raise (std::ostream &, bool terminateAfterMsg=true)
void raise (const char *, bool terminateAfterMsg=true)
void truncateTrailingSpaces (bool willTruncate=true)
bool willTruncateTrailingSpaces ()

Static Public Attributes

long sFileMode = SHARED | PERMANENT

Protected Types

enum  connectionFileStateT {
  eIdle = 0, eStart = 1, eOpenedFile = 2, eCreatedFile = 4,
  eInvalidlyOpenInCreation = 8, eInvalidlyCreationInOpen = 16
}

Protected Member Functions

void BuildConnectionSchemas ()
void FinishNewConnection (const char *connectionName)
void FinishOpenConnection (const char *connectionName)
bool FinishOpenOrCreateConnection (const char *connectionName)
void MakeAllTablesValid () const
 Final step in construction, can use tables against database after this.

void InitOpenOrCreateState ()
void OpenOrCreateStateTransition (bool inOpenedOrCreated)
 Manage state transitions for FinishOpenOrCreateConnection.

virtual void WriteOOFSchemaFile ()
 Write the oofschema out to the schema file.

virtual oofString MakeSchemaFileName ()
 produce a file name for schema file.

oofString MakeOOFSchemaString ()
 Produce a string containing the oofschema with the length of the schema string aphended to the end.


Protected Attributes

bool mHasBlobs
bool mUseSuperfile
eLockingStates mLockingState
int mReadLockApplications
int mWriteLockApplications
long mSuperFilNo
long mBlobFilNo
char mCtreeInstanceName [32]
void * mCtreeVars
unsigned int mNumFiles
unsigned int mNumIndexes
OOF_Dictionary mTables
oofString mConnectionName
oofString mSchemaFileName
bool mOpen
bool mTempDatabase
bool mInDeclarativePhase
oofWordParsermDefaultPrototypeParser
oofDirectorymDatabaseDir
connectionFileStateT mFileState
bool mHidden

Static Protected Attributes

unsigned long sConnectionsOpened
dbConnect_ctreesActiveConnection
dbConnectsCurrentlyConstructing
 this static gets zeroed in dbTable::postCloneTableCleanup() this is how we avoid passing dbTable pointers around all the time when creating fields particularly in user constructors when it would clutter things up a LOT!

bool sTruncateTrailingSpaces = false
oofString sSchemaFileExt = "osc"


Member Enumeration Documentation

enum dbConnect::connectionFileStateT [protected, inherited]
 

Enumeration values:
eIdle 
eStart 
eOpenedFile 
eCreatedFile 
eInvalidlyOpenInCreation 
eInvalidlyCreationInOpen 

enum dbConnect_ctree::eLockingStates
 

Enumeration values:
noLocking 
readLocking 
writeLocking 


Constructor & Destructor Documentation

dbConnect_ctree::dbConnect_ctree bool  isTemporary = false  ) 
 

dbConnect_ctree::~dbConnect_ctree  )  [virtual]
 


Member Function Documentation

void dbConnect_ctree::activateConnection  ) 
 

long dbConnect_ctree::allocBlobFilNo  ) 
 

void dbConnect::attachTable dbTable  )  [inherited]
 

void dbConnect_ctree::blobsHaveBeenFound  ) 
 

void dbConnect_ctree::buildConnectionSchemaFromFile const char *  connectionName  ) 
 

void dbConnect_ctree::BuildConnectionSchemas  )  [protected]
 

void dbConnect_ctree::close  )  [virtual]
 

Implements dbConnect.

const oofString & dbConnect::connectionName  )  const [inline, inherited]
 

void dbConnect::copyAllFrom dbConnect  )  [inherited]
 

dbConnect * dbConnect::currentlyConstructing  )  [inline, static, inherited]
 

oofDirectory * dbConnect::databaseDirectory  )  const [inline, inherited]
 

void dbConnect::deleteAll  )  [inherited]
 

void dbConnect_ctree::deleteStorage  )  [virtual]
 

Reimplemented from dbConnect.

void dbConnect::describe std::ostream &  os  )  const [virtual, inherited]
 

Provide human-readable information about object.

Overriden to provide much more detail particularly for dbTable::describe() which provides full schema.

Reimplemented from OOF_PublicBase.

void dbConnect::dumpData std::ostream &   )  [inherited]
 

void dbConnect_ctree::enterReadLocking  )  [virtual]
 

Implements dbConnect.

void dbConnect_ctree::enterWriteLocking  )  [virtual]
 

Implements dbConnect.

void dbConnect_ctree::exitLocking  )  [virtual]
 

Implements dbConnect.

void dbConnect::extract std::ostream &  os  )  [inline, inherited]
 

bool dbConnect::fileExists const char *  fName  )  [static, inherited]
 

void dbConnect_ctree::FinishNewConnection const char *  connectionName  )  [protected]
 

void dbConnect_ctree::FinishOpenConnection const char *  connectionName  )  [protected]
 

bool dbConnect_ctree::FinishOpenOrCreateConnection const char *  connectionName  )  [protected]
 

Returns:
true if open file, false if create

void dbConnect::generateTestData unsigned long  maxRecs = 10000,
bool  generateRandom = true,
unsigned long  seedOrCount = 0
[inherited]
 

oofWordParser * dbConnect::getDefaultWordParser  )  [inherited]
 

void dbConnect::gotoDatabaseDir  )  const [inherited]
 

bool OOF_PublicBase::hidden  )  const [inline, inherited]
 

void OOF_PublicBase::hide bool  hideIt = true  )  [inline, inherited]
 

bool dbConnect::inDeclarativePhase  )  const [inline, inherited]
 

Connection has been declared but not opened or created.

Only one connection at a time can be in this state.

Todo:
cope if declare 2nd connections before opening either, which is legal.

void dbConnect::InitOpenOrCreateState  )  [protected, inherited]
 

short dbConnect_ctree::isam_err  )  const
 

bool dbConnect::isOpen  )  const [inline, inherited]
 

bool dbConnect_ctree::isReadLocked  )  const [inline]
 

bool dbConnect_ctree::isWriteLocked  )  const [inline]
 

void dbConnect::MakeAllTablesValid  )  const [protected, inherited]
 

Final step in construction, can use tables against database after this.

Note:
resets dbTable::sCurrentlyConstructing to detect fields declared outside tables

oofString dbConnect::MakeOOFSchemaString  )  [protected, inherited]
 

Produce a string containing the oofschema with the length of the schema string aphended to the end.

The length is used as an offset in dbConnect_rampBackend to find the schema beginning

oofString dbConnect::MakeSchemaFileName  )  [protected, virtual, inherited]
 

produce a file name for schema file.

If a file name exists for the data base use it with the extension sSchemaFileExt (default "osc") else use the connection name with sSchemaFileExt appended.

Todo:
rewrite

OOF_String dbConnect_ctree::makeTableName const char *   )  const
 

oofString dbConnect::name  )  const [virtual, inherited]
 

Reimplemented from OOF_PublicBase.

void dbConnect_ctree::newConnection const FSSpec &   )  [virtual]
 

Implements dbConnect.

void dbConnect_ctree::newConnection const char *  connectionName  )  [virtual]
 

Implements dbConnect.

unsigned int dbConnect::numTables  )  const [inline, inherited]
 

void dbConnect_ctree::openConnection const FSSpec &   )  [virtual]
 

Implements dbConnect.

void dbConnect_ctree::openConnection const char *  connectionName  )  [virtual]
 

Implements dbConnect.

bool dbConnect_ctree::openOrCreateConnection const char *  connectionName  )  [virtual]
 

void dbConnect::OpenOrCreateStateTransition bool  inOpenedVSCreated  )  [protected, inherited]
 

Manage state transitions for FinishOpenOrCreateConnection.

Parameters:
inOpenedVSCreated is true if just created file, false if opened

void dbConnect::raise const char *  ,
bool  terminateAfterMsg = true
[static, inherited]
 

void dbConnect::raise std::ostream &  ,
bool  terminateAfterMsg = true
[static, inherited]
 

void dbConnect::readOOFSchema const oofString schemaFileName  )  [virtual, inherited]
 

Reads & parses oofSchema from the file schemaFileName.

Populates the dbConnect::sCurrentlyConstructing connection with extra tables.

Todo:
make a version that takes oofFileRef

void dbConnect_ctree::resetLocks  ) 
 

void dbConnect::resumeSorting  )  const [inherited]
 

void dbConnect::schemaFileExt const oofString  )  [inherited]
 

void dbConnect::setDefaultWordParser oofWordParser inParser  )  [inherited]
 

void dbConnect::stats std::ostream &   )  [virtual, inherited]
 

void dbConnect::suspendSorting  )  const [inherited]
 

short dbConnect_ctree::sysiocod  )  const
 

dbTable * dbConnect::table const char *   )  [inherited]
 

dbTable * dbConnect::table unsigned  int  )  const [inherited]
 

void dbConnect::truncateTrailingSpaces bool  willTruncate = true  )  [inline, static, inherited]
 

short dbConnect_ctree::uerr_cod  )  const
 

bool dbConnect::underConstruction  )  [inline, static, inherited]
 

void dbConnect_ctree::useExclusiveAccess  ) 
 

void dbConnect_ctree::useSeparateFiles  ) 
 

bool dbConnect_ctree::usesSeparateStorageFiles  )  const [virtual]
 

Reimplemented from dbConnect.

bool dbConnect::willTruncateTrailingSpaces  )  [inline, static, inherited]
 

void dbConnect::WriteOOFSchemaFile  )  [protected, virtual, inherited]
 

Write the oofschema out to the schema file.

Note:
temporarily changes current directory whilst writing file.


Member Data Documentation

long dbConnect_ctree::mBlobFilNo [protected]
 

oofString dbConnect::mConnectionName [protected, inherited]
 

char dbConnect_ctree::mCtreeInstanceName[32] [protected]
 

void* dbConnect_ctree::mCtreeVars [protected]
 

oofDirectory* dbConnect::mDatabaseDir [protected, inherited]
 

oofWordParser* dbConnect::mDefaultPrototypeParser [protected, inherited]
 

connectionFileStateT dbConnect::mFileState [protected, inherited]
 

bool dbConnect_ctree::mHasBlobs [protected]
 

bool OOF_PublicBase::mHidden [protected, inherited]
 

bool dbConnect::mInDeclarativePhase [protected, inherited]
 

eLockingStates dbConnect_ctree::mLockingState [protected]
 

unsigned int dbConnect_ctree::mNumFiles [protected]
 

unsigned int dbConnect_ctree::mNumIndexes [protected]
 

bool dbConnect::mOpen [protected, inherited]
 

int dbConnect_ctree::mReadLockApplications [protected]
 

oofString dbConnect::mSchemaFileName [protected, inherited]
 

long dbConnect_ctree::mSuperFilNo [protected]
 

OOF_Dictionary dbConnect::mTables [protected, inherited]
 

bool dbConnect::mTempDatabase [protected, inherited]
 

bool dbConnect_ctree::mUseSuperfile [protected]
 

int dbConnect_ctree::mWriteLockApplications [protected]
 

dbConnect_ctree * dbConnect_ctree::sActiveConnection [static, protected]
 

unsigned long dbConnect_ctree::sConnectionsOpened [static, protected]
 

dbConnect * dbConnect::sCurrentlyConstructing [static, protected, inherited]
 

this static gets zeroed in dbTable::postCloneTableCleanup() this is how we avoid passing dbTable pointers around all the time when creating fields particularly in user constructors when it would clutter things up a LOT!

Warning:
this is NOT thread-safe - do not construct tables in simultaneous threads

long dbConnect_ctree::sFileMode = SHARED | PERMANENT [static]
 

oofString dbConnect::sSchemaFileExt = "osc" [static, protected, inherited]
 

bool dbConnect::sTruncateTrailingSpaces = false [static, protected, inherited]
 


The documentation for this class was generated from the following files:
Generated on Fri Jan 2 00:50:12 2004 for OOFILE by doxygen 1.3.5