OOFILE  1.9
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members

Connection that manufactures OOF_ctreeBackend backends. More...

#include <oofctree.h>

Inheritance diagram for dbConnect_ctree:
Inheritance graph
[legend]
Collaboration diagram for dbConnect_ctree:
Collaboration graph
[legend]

Public Types

enum  eLockingStates { noLocking, readLocking, writeLocking }
 

Public Member Functions

void attachTable (dbTable *)
 
void buildConnectionSchemaFromFile (const char *connectionName)
 
virtual void close ()
 
const oofStringconnectionName () const
 
void copyAllFrom (dbConnect *)
 
oofDirectorydatabaseDirectory () const
 
 dbConnect_ctree (bool isTemporary=false)
 
void deleteAll ()
 
virtual void deleteStorage ()
 
virtual void describe (std::ostream &) const
 Provide human-readable information about object. More...
 
void dumpData (std::ostream &)
 
void extract (std::ostream &os)
 
void generateTestData (unsigned long maxRecs=10000, bool generateRandom=true, unsigned long seedOrCount=0)
 
oofWordParsergetDefaultWordParser ()
 
void gotoDatabaseDir () const
 
bool hidden () const
 
void hide (bool hideIt=true)
 
bool inDeclarativePhase () const
 Connection has been declared but not opened or created. More...
 
bool isOpen () const
 
bool isReadLocked () const
 
bool isWriteLocked () const
 
OOF_String makeTableName (const char *) const
 
virtual oofString name () const
 
virtual void newConnection (const char *connectionName)
 
virtual void newConnection (const FSSpec &)
 
unsigned int numTables () const
 
virtual void openConnection (const char *connectionName)
 
virtual void openConnection (const FSSpec &)
 
virtual bool openOrCreateConnection (const char *connectionName)
 
virtual void readOOFSchema (const oofString &schemaFileName)
 Reads & parses oofSchema from the file schemaFileName. More...
 
void resetLocks ()
 
void resumeSorting () const
 
void schemaFileExt (const oofString &)
 
void setDefaultWordParser (oofWordParser *inParser)
 
virtual void stats (std::ostream &)
 
void suspendSorting () const
 
dbTabletable (unsigned int) const
 
dbTabletable (const char *)
 
void useExclusiveAccess ()
 
void useSeparateFiles ()
 
virtual bool usesSeparateStorageFiles () const
 
virtual void writeOOFSchema ()
 Write an OOFILE schema into a ctree resource. More...
 
virtual ~dbConnect_ctree ()
 
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 ()
 

Static Public Member Functions

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

Static Public Attributes

static 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 InitOpenOrCreateState ()
 
void MakeAllTablesValid () const
 Final step in construction, can use tables against database after this. More...
 
oofString MakeOOFSchemaString ()
 Produce a string containing the oofschema with the length of the schema string aphended to the end. More...
 
virtual oofString MakeSchemaFileName ()
 produce a file name for schema file. More...
 
void OpenOrCreateStateTransition (bool inOpenedOrCreated)
 Manage state transitions for FinishOpenOrCreateConnection. More...
 
virtual void WriteOOFSchemaFile ()
 Write the oofschema out to the schema file. More...
 

Protected Attributes

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

Static Protected Attributes

static dbConnect_ctreesActiveConnection
 
static unsigned long sConnectionsOpened
 
static 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! More...
 
static oofString sSchemaFileExt ="osc"
 
static bool sTruncateTrailingSpaces = false
 

Detailed Description

Connection that manufactures OOF_ctreeBackend backends.

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

Definition at line 39 of file oofctree.h.

Constructor & Destructor Documentation

dbConnect_ctree::dbConnect_ctree ( bool  isTemporary = false)

Definition at line 74 of file oofctre4.cpp.

References mCtreeInstanceName.

dbConnect_ctree::~dbConnect_ctree ( )
virtual

Definition at line 89 of file oofctre4.cpp.

References close(), deleteStorage(), dbConnect::mOpen, and dbConnect::mTempDatabase.

Member Function Documentation

void dbConnect_ctree::activateConnection ( )
long dbConnect_ctree::allocBlobFilNo ( )

Definition at line 271 of file oofctre4.cpp.

References mBlobFilNo.

Referenced by OOF_ctreeBackend::buildSchema().

void dbConnect::attachTable ( dbTable theTable)
inherited
void dbConnect_ctree::blobsHaveBeenFound ( )

Definition at line 264 of file oofctre4.cpp.

References mHasBlobs.

Referenced by OOF_ctreeBackend::buildSchema().

void dbConnect_ctree::buildConnectionSchemaFromFile ( const char *  connectionName)
void dbConnect_ctree::BuildConnectionSchemas ( )
protected
void dbConnect_ctree::close ( )
virtual
const oofString & dbConnect::connectionName ( ) const
inlineinherited
void dbConnect::copyAllFrom ( dbConnect rhs)
inherited
dbConnect * dbConnect::currentlyConstructing ( )
inlinestaticinherited
oofDirectory * dbConnect::databaseDirectory ( ) const
inlineinherited

Definition at line 1683 of file oof1.h.

Referenced by OOF_dbaseBackend::deleteStorage(), and OOF_ctreeBackend::deleteStorage().

void dbConnect::deleteAll ( )
inherited
void dbConnect_ctree::deleteStorage ( )
virtual
void dbConnect::describe ( std::ostream &  ) const
virtualinherited

Provide human-readable information about object.

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

Reimplemented from OOF_PublicBase.

Definition at line 562 of file oof1.cpp.

References OOF_Dictionary::describe(), dbConnect::mConnectionName, and dbConnect::mTables.

Referenced by dbConnect::MakeOOFSchemaString(), dbConnect::WriteOOFSchemaFile(), and OOF_XMLrepParser::~OOF_XMLrepParser().

void dbConnect::dumpData ( std::ostream &  )
inherited
void dbConnect_ctree::enterReadLocking ( )
virtual
void dbConnect_ctree::enterWriteLocking ( )
virtual
void dbConnect_ctree::exitLocking ( )
virtual
void dbConnect::extract ( std::ostream &  os)
inlineinherited

Definition at line 967 of file oof1.h.

Referenced by OOF_XMLrepParser::~OOF_XMLrepParser().

bool dbConnect::fileExists ( const char *  fName)
staticinherited

Definition at line 683 of file oof1.cpp.

References oofDirectory::fileExists().

void dbConnect_ctree::FinishNewConnection ( const char *  connectionName)
protected
void dbConnect_ctree::FinishOpenConnection ( const char *  connectionName)
protected
bool dbConnect_ctree::FinishOpenOrCreateConnection ( const char *  connectionName)
protected
void dbConnect::generateTestData ( unsigned long  maxRecs = 10000,
bool  generateRandom = true,
unsigned long  seedOrCount = 0 
)
inherited
oofWordParser * dbConnect::getDefaultWordParser ( )
inherited

Definition at line 754 of file oof1.cpp.

References dbConnect::mDefaultPrototypeParser.

Referenced by dbTable::getDefaultWordParser().

void dbConnect::gotoDatabaseDir ( ) const
inherited
bool OOF_PublicBase::hidden ( ) const
inlineinherited

Definition at line 51 of file oof1.h.

Referenced by OOF_Dictionary::EntryMatchesVisibility().

void OOF_PublicBase::hide ( bool  hideIt = true)
inlineinherited

Definition at line 52 of file oof1.h.

bool dbConnect::inDeclarativePhase ( ) const
inlineinherited

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.

Definition at line 1702 of file oof1.h.

void dbConnect::InitOpenOrCreateState ( )
protectedinherited

Definition at line 748 of file oof1.cpp.

References dbConnect::eStart, and dbConnect::mFileState.

Referenced by FinishOpenOrCreateConnection().

short dbConnect_ctree::isam_err ( ) const

Definition at line 789 of file oofctre4.cpp.

References mCtreeVars.

bool dbConnect::isOpen ( ) const
inlineinherited

Definition at line 1690 of file oof1.h.

bool dbConnect_ctree::isReadLocked ( ) const
inline

Definition at line 133 of file oofctree.h.

References mLockingState, and readLocking.

Referenced by OOF_ctreeBackend::newRecord().

bool dbConnect_ctree::isWriteLocked ( ) const
inline

Definition at line 144 of file oofctree.h.

References mLockingState, and writeLocking.

void dbConnect::MakeAllTablesValid ( ) const
protectedinherited

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

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

Definition at line 419 of file oof1.cpp.

References OOF_Dictionary::count(), dbConnect::mTables, dbConnect::numTables(), dbTable::setTableValid(), and OOF_Dictionary::value().

Referenced by dbConnect_ram::newConnection(), dbConnect_ram::openConnection(), and dbConnect_ram::openOrCreateConnection().

oofString dbConnect::MakeOOFSchemaString ( )
protectedinherited

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

Definition at line 521 of file oof1.cpp.

References oofString::convertNumber(), dbConnect::describe(), and oofString::length().

oofString dbConnect::MakeSchemaFileName ( )
protectedvirtualinherited

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

Definition at line 463 of file oof1.cpp.

Referenced by dbConnect::WriteOOFSchemaFile().

OOF_String dbConnect_ctree::makeTableName ( const char *  str) const
oofString dbConnect::name ( ) const
virtualinherited

Reimplemented from OOF_PublicBase.

Definition at line 409 of file oof1.cpp.

References dbConnect::connectionName().

void dbConnect_ctree::newConnection ( const char *  connectionName)
virtual
void dbConnect_ctree::newConnection ( const FSSpec &  inMacFSSpec)
virtual

Implements dbConnect.

Definition at line 332 of file oofctre4.cpp.

References FinishNewConnection(), dbConnect::mDatabaseDir, dbConnect::mOpen, and RAISE_EXCEPTION.

unsigned int dbConnect::numTables ( ) const
inlineinherited
void dbConnect_ctree::openConnection ( const char *  connectionName)
virtual
void dbConnect_ctree::openConnection ( const FSSpec &  inMacFSSpec)
virtual

Implements dbConnect.

Definition at line 347 of file oofctre4.cpp.

References FinishOpenConnection(), dbConnect::mDatabaseDir, dbConnect::mOpen, and RAISE_EXCEPTION.

bool dbConnect_ctree::openOrCreateConnection ( const char *  connectionName)
virtual
void dbConnect::OpenOrCreateStateTransition ( bool  inOpenedVSCreated)
protectedinherited

Manage state transitions for FinishOpenOrCreateConnection.

Parameters
inOpenedVSCreatedis true if just created file, false if opened

Definition at line 727 of file oof1.cpp.

References dbConnect::eCreatedFile, dbConnect::eInvalidlyCreationInOpen, dbConnect::eInvalidlyOpenInCreation, dbConnect::eOpenedFile, dbConnect::eStart, and dbConnect::mFileState.

Referenced by FinishOpenOrCreateConnection().

static void dbConnect::raise ( std::ostream &  ,
bool  terminateAfterMsg = true 
)
staticinherited

Referenced by dbBrowseHelper::browseViewWithListBox(), dbBrowseHelper::browseViewWithTable(), OOF_ramBackend::BuildBackendtables(), OOF_dbaseBackend::BuildBackendtables(), OOF_ctreeBackend::BuildBackendtables(), dbRelRefBase::BuildRelatedTable(), oofRepMacGUIPreviewPP::calcPageHeight(), dbTable::copyAllFrom(), dbChar::copyValueFrom(), dbShort::copyValueFrom(), dbUshort::copyValueFrom(), dbBool::copyValueFrom(), dbLong::copyValueFrom(), dbUlong::copyValueFrom(), dbText::copyValueFrom(), dbReal::copyValueFrom(), dbDate::copyValueFrom(), dbTime::copyValueFrom(), dbDateTime::copyValueFrom(), dbShort::copyValueIfDifferent(), dbChar::copyValueIfDifferent(), dbUshort::copyValueIfDifferent(), dbBool::copyValueIfDifferent(), dbLong::copyValueIfDifferent(), dbUlong::copyValueIfDifferent(), dbText::copyValueIfDifferent(), dbReal::copyValueIfDifferent(), dbDate::copyValueIfDifferent(), dbTime::copyValueIfDifferent(), dbDateTime::copyValueIfDifferent(), OOF_ctreeBackend::countAll(), OOF_dbaseBackend::createTableInConnection(), dbDate::currentCentury(), dbDate::currentDate2ymd(), dbTime::currentTime2hms(), dbDateTime::currentTime2ymdhms(), dbDateTime::daysInMonth(), dbField::dbField(), dbTable::dbTable(), OOF_ramBackend::deleteRecord(), OOF_dbaseBackend::deleteRecord(), OOF_ctreeBackend::deleteRecord(), oofRepWindow::DoOpen(), enterReadLocking(), enterWriteLocking(), dbField::equivalentFieldFromTable(), OOF_ULSorter::exchange(), OOF_ULPSorter::exchange(), exitLocking(), dbQueryField::getSearchTables(), OOF_ramBackend::gotoRecord(), OOF_dbaseBackend::gotoRecord(), OOF_ctreeBackend::gotoRecord(), OOF_mixKeywordableField::indexWords(), dbChar::insert(), dbText::insert(), dbTable::insert(), dbRelationship::linkMNvia(), OOF_dbaseBackend::loadBlob(), dbConnect_dbase::newConnection(), OOF_ctreeBackend::newRecord(), dbConnect_dbase::openConnection(), dbConnect_dbase::openOrCreateConnection(), OOF_dbaseBackend::openTableInConnection(), dbChar::operator+=(), OOF_XMLrepParser::parseFile(), dbRelRefBase::propagateRelatedDeletes(), dbBrowseHelper::receiveMsg(), dbRelRefBase::relatesTo(), oofBroadcaster::removeReceiver(), OOF_simpleRecordBackend::revertRecord(), OOF_simpleRecordBackend::search(), OOF_simpleRecordBackend::SearchBetweenNonIndexed(), OOF_simpleRecordBackend::SearchBinaryFieldToLiteral(), OOF_simpleRecordBackend::SearchComparativeNonIndexed(), OOF_simpleRecordBackend::SearchEqualNonIndexed(), OOF_simpleRecordBackend::SearchNotEqualNonIndexed(), OOF_simpleRecordBackend::SearchOutsideNonIndexed(), OOF_simpleRecordBackend::SearchSelectionBinaryFieldToLiteral(), OOF_simpleRecordBackend::selectJustOID(), dbChar::setChars(), dbRelRefBase::SetCommonRelationshipFields(), OOF_simpleRecordBackend::sortSelectionInverseNow(), OOF_simpleRecordBackend::sortSelectionNow(), OOF_simpleRecordBackend::SubSort(), oofSingleListener::suspendListening(), dbDateTime::ulong2ymdhms(), dbField::valueAsQueryLiteral(), dbAbstractEditHelper::warnUser(), and OOF_recordCache::~OOF_recordCache().

void dbConnect::raise ( const char *  str,
bool  terminateAfterMsg = true 
)
staticinherited

Definition at line 698 of file oof1.cpp.

References oofErrorReporter::defaultReporter(), and oofErrorReporter::raise().

void dbConnect::readOOFSchema ( const oofString schemaFileName)
virtualinherited

Reads & parses oofSchema from the file schemaFileName.

Populates the dbConnect::sCurrentlyConstructing connection with extra tables.

Todo:
make a version that takes oofFileRef

Definition at line 548 of file oof1.cpp.

References dbConnect::sCurrentlyConstructing.

void dbConnect_ctree::resetLocks ( )
void dbConnect::resumeSorting ( ) const
inherited
void dbConnect::schemaFileExt ( const oofString newExt)
inherited

Definition at line 717 of file oof1.cpp.

References dbConnect::sSchemaFileExt.

void dbConnect::setDefaultWordParser ( oofWordParser inParser)
inherited

Definition at line 764 of file oof1.cpp.

References dbConnect::mDefaultPrototypeParser.

void dbConnect::stats ( std::ostream &  )
virtualinherited
void dbConnect::suspendSorting ( ) const
inherited
short dbConnect_ctree::sysiocod ( ) const

Definition at line 777 of file oofctre4.cpp.

References mCtreeVars.

dbTable * dbConnect::table ( unsigned int  tableNum) const
inherited
dbTable * dbConnect::table ( const char *  tableName)
inherited

Definition at line 443 of file oof1.cpp.

References dbConnect::mTables.

void dbConnect::truncateTrailingSpaces ( bool  willTruncate = true)
inlinestaticinherited

Definition at line 1660 of file oof1.h.

short dbConnect_ctree::uerr_cod ( ) const

Definition at line 764 of file oofctre4.cpp.

References mCtreeVars.

Referenced by OOF_ctreeBackend::beginTransaction(), and OOF_ctreeBackend::loadBlob().

bool dbConnect::underConstruction ( )
inlinestaticinherited

Definition at line 1653 of file oof1.h.

void dbConnect_ctree::useExclusiveAccess ( )

Definition at line 755 of file oofctre4.cpp.

References sFileMode, and OOF_ctreeBackend::sFileMode.

void dbConnect_ctree::useSeparateFiles ( )

Definition at line 748 of file oofctre4.cpp.

References mUseSuperfile.

bool dbConnect_ctree::usesSeparateStorageFiles ( ) const
virtual

Reimplemented from dbConnect.

Definition at line 625 of file oofctre4.cpp.

References mUseSuperfile.

Referenced by OOF_ctreeBackend::deleteStorage().

bool dbConnect::willTruncateTrailingSpaces ( )
inlinestaticinherited

Definition at line 1667 of file oof1.h.

Referenced by dbChar::insert(), and dbText::insert().

void dbConnect::WriteOOFSchemaFile ( )
protectedvirtualinherited

Write the oofschema out to the schema file.

Note
temporarily changes current directory whilst writing file.

Definition at line 502 of file oof1.cpp.

References dbConnect::describe(), dbConnect::gotoDatabaseDir(), and dbConnect::MakeSchemaFileName().

Referenced by dbConnect::writeOOFSchema().

Member Data Documentation

long dbConnect_ctree::mBlobFilNo
protected

Definition at line 115 of file oofctree.h.

Referenced by allocBlobFilNo().

oofString dbConnect::mConnectionName
protectedinherited
char dbConnect_ctree::mCtreeInstanceName[32]
protected

Definition at line 116 of file oofctree.h.

Referenced by activateConnection(), close(), and dbConnect_ctree().

void* dbConnect_ctree::mCtreeVars
protected

Definition at line 117 of file oofctree.h.

Referenced by isam_err(), sysiocod(), and uerr_cod().

oofDirectory* dbConnect::mDatabaseDir
protectedinherited
oofWordParser* dbConnect::mDefaultPrototypeParser
protectedinherited
connectionFileStateT dbConnect::mFileState
protectedinherited
bool dbConnect_ctree::mHasBlobs
protected

Definition at line 112 of file oofctree.h.

Referenced by blobsHaveBeenFound(), BuildConnectionSchemas(), and deleteStorage().

bool OOF_PublicBase::mHidden
protectedinherited

Definition at line 61 of file oof1.h.

bool dbConnect::mInDeclarativePhase
protectedinherited

Definition at line 1023 of file oof1.h.

eLockingStates dbConnect_ctree::mLockingState
protected

Definition at line 113 of file oofctree.h.

Referenced by exitLocking(), isReadLocked(), isWriteLocked(), and resetLocks().

unsigned int dbConnect_ctree::mNumFiles
protected

Definition at line 119 of file oofctree.h.

Referenced by BuildConnectionSchemas().

unsigned int dbConnect_ctree::mNumIndexes
protected

Definition at line 119 of file oofctree.h.

Referenced by BuildConnectionSchemas().

bool dbConnect::mOpen
protectedinherited
int dbConnect_ctree::mReadLockApplications
protected

Definition at line 114 of file oofctree.h.

Referenced by enterReadLocking(), enterWriteLocking(), and exitLocking().

oofString dbConnect::mSchemaFileName
protectedinherited

Definition at line 1022 of file oof1.h.

Referenced by newConnection().

long dbConnect_ctree::mSuperFilNo
protected
OOF_Dictionary dbConnect::mTables
protectedinherited
bool dbConnect::mTempDatabase
protectedinherited
bool dbConnect_ctree::mUseSuperfile
protected
int dbConnect_ctree::mWriteLockApplications
protected

Definition at line 114 of file oofctree.h.

Referenced by enterReadLocking(), enterWriteLocking(), and exitLocking().

dbConnect_ctree * dbConnect_ctree::sActiveConnection
staticprotected

Definition at line 121 of file oofctree.h.

Referenced by activateConnection().

unsigned long dbConnect_ctree::sConnectionsOpened
staticprotected

Definition at line 120 of file oofctree.h.

Referenced by close().

dbConnect * dbConnect::sCurrentlyConstructing
staticprotectedinherited

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

Definition at line 1026 of file oof1.h.

Referenced by dbConnect::dbConnect(), dbConnect::readOOFSchema(), and dbConnect_ram::SetupConnection().

long dbConnect_ctree::sFileMode = SHARED | PERMANENT
static
oofString dbConnect::sSchemaFileExt ="osc"
staticprotectedinherited

Definition at line 1029 of file oof1.h.

Referenced by dbConnect::schemaFileExt().

bool dbConnect::sTruncateTrailingSpaces = false
staticprotectedinherited

Definition at line 1027 of file oof1.h.


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