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

Connection that manufactures OOF_fservBackend backends. More...

#include <oofFsrv.h>

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

Public Types

enum  eLockingStates { noLocking, readLocking, writeLocking }
 

Public Member Functions

void activateConnection ()
 
long allocBlobFilNo ()
 
void attachTable (dbTable *)
 
void blobsHaveBeenFound ()
 
void buildConnectionSchemaFromFile (const char *connectionName)
 
virtual void close ()
 
const oofStringconnectionName () const
 
void copyAllFrom (dbConnect *)
 
oofDirectorydatabaseDirectory () const
 
 dbConnect_FServ (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 &)
 
virtual void enterReadLocking ()
 
virtual void enterWriteLocking ()
 
virtual void exitLocking ()
 
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...
 
short isam_err () const
 
bool isFileOnServer (const char *) const
 
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 char *connectionName, dbUser *optionalLoginInfo=0)
 
virtual void newConnection (const FSSpec &)
 
unsigned int numTables () const
 
virtual void openConnection (const char *connectionName)
 
virtual void openConnection (const char *connectionName, dbUser *optionalLoginInfo=0)
 
virtual void openConnection (const FSSpec &)
 
virtual bool openOrCreateConnection (const char *connectionName)
 
virtual bool openOrCreateConnection (const char *connectionName, dbUser *optionalLoginInfo=0)
 
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
 
short sysiocod () const
 
dbTabletable (unsigned int) const
 
dbTabletable (const char *)
 
short uerr_cod () const
 
void useExclusiveAccess ()
 
void useSeparateFiles ()
 
virtual bool usesSeparateStorageFiles () const
 
virtual void writeOOFSchema ()
 
virtual ~dbConnect_FServ ()
 

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
 

Protected Member Functions

void BuildConnectionSchemas ()
 
void FinishNewConnection (const char *connectionName, dbUser *optionalLoginInfo=0)
 
void FinishOpenConnection (const char *connectionName, dbUser *optionalLoginInfo=0)
 
bool FinishOpenOrCreateConnection (const char *connectionName, dbUser *optionalLoginInfo=0)
 
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
 
oofDirectorymDatabaseDir
 
oofWordParsermDefaultPrototypeParser
 
char mFServInstanceName [32]
 
void * mFServVars
 
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_FServsActiveConnection
 
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_fservBackend backends.

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

Todo:
rename to dbConnect_fserv

Definition at line 48 of file oofFsrv.h.

Constructor & Destructor Documentation

dbConnect_FServ::dbConnect_FServ ( bool  isTemporary = false)
virtual dbConnect_FServ::~dbConnect_FServ ( )
virtual

Member Function Documentation

void dbConnect_FServ::activateConnection ( )
long dbConnect_FServ::allocBlobFilNo ( )
void dbConnect::attachTable ( dbTable theTable)
inherited
void dbConnect_FServ::blobsHaveBeenFound ( )
void dbConnect_FServ::buildConnectionSchemaFromFile ( const char *  connectionName)
void dbConnect_FServ::BuildConnectionSchemas ( )
protected
virtual void dbConnect_FServ::close ( )
virtual

Implements dbConnect.

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
virtual void dbConnect_FServ::deleteStorage ( )
virtual

Reimplemented from dbConnect.

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
virtual void dbConnect_FServ::enterReadLocking ( )
virtual

Implements dbConnect.

virtual void dbConnect_FServ::enterWriteLocking ( )
virtual

Implements dbConnect.

virtual void dbConnect_FServ::exitLocking ( )
virtual

Implements dbConnect.

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_FServ::FinishNewConnection ( const char *  connectionName,
dbUser optionalLoginInfo = 0 
)
protected
void dbConnect_FServ::FinishOpenConnection ( const char *  connectionName,
dbUser optionalLoginInfo = 0 
)
protected
bool dbConnect_FServ::FinishOpenOrCreateConnection ( const char *  connectionName,
dbUser optionalLoginInfo = 0 
)
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 dbConnect_ctree::FinishOpenOrCreateConnection().

short dbConnect_FServ::isam_err ( ) const
bool dbConnect_FServ::isFileOnServer ( const char *  ) const
bool dbConnect::isOpen ( ) const
inlineinherited

Definition at line 1690 of file oof1.h.

bool dbConnect_FServ::isReadLocked ( ) const
inline

Definition at line 155 of file oofFsrv.h.

References mLockingState, and readLocking.

bool dbConnect_FServ::isWriteLocked ( ) const
inline

Definition at line 166 of file oofFsrv.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_FServ::makeTableName ( const char *  ) const
oofString dbConnect::name ( ) const
virtualinherited

Reimplemented from OOF_PublicBase.

Definition at line 409 of file oof1.cpp.

References dbConnect::connectionName().

virtual void dbConnect_FServ::newConnection ( const char *  connectionName)
virtual

Implements dbConnect.

virtual void dbConnect_FServ::newConnection ( const char *  connectionName,
dbUser optionalLoginInfo = 0 
)
virtual
virtual void dbConnect_FServ::newConnection ( const FSSpec &  )
virtual

Implements dbConnect.

unsigned int dbConnect::numTables ( ) const
inlineinherited
virtual void dbConnect_FServ::openConnection ( const char *  connectionName)
virtual

Implements dbConnect.

virtual void dbConnect_FServ::openConnection ( const char *  connectionName,
dbUser optionalLoginInfo = 0 
)
virtual
virtual void dbConnect_FServ::openConnection ( const FSSpec &  )
virtual

Implements dbConnect.

virtual bool dbConnect_FServ::openOrCreateConnection ( const char *  connectionName)
virtual
virtual bool dbConnect_FServ::openOrCreateConnection ( const char *  connectionName,
dbUser optionalLoginInfo = 0 
)
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 dbConnect_ctree::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(), dbConnect_ctree::enterReadLocking(), dbConnect_ctree::enterWriteLocking(), dbField::equivalentFieldFromTable(), OOF_ULSorter::exchange(), OOF_ULPSorter::exchange(), dbConnect_ctree::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_FServ::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_FServ::sysiocod ( ) const
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_FServ::uerr_cod ( ) const
bool dbConnect::underConstruction ( )
inlinestaticinherited

Definition at line 1653 of file oof1.h.

void dbConnect_FServ::useExclusiveAccess ( )
void dbConnect_FServ::useSeparateFiles ( )
virtual bool dbConnect_FServ::usesSeparateStorageFiles ( ) const
virtual

Reimplemented from dbConnect.

bool dbConnect::willTruncateTrailingSpaces ( )
inlinestaticinherited

Definition at line 1667 of file oof1.h.

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

void dbConnect::writeOOFSchema ( )
virtualinherited

Reimplemented in dbConnect_ctree, dbConnect_ramp, and dbConnect_ram.

Definition at line 535 of file oof1.cpp.

References dbConnect::WriteOOFSchemaFile().

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_FServ::mBlobFilNo
protected

Definition at line 137 of file oofFsrv.h.

oofString dbConnect::mConnectionName
protectedinherited
oofDirectory* dbConnect::mDatabaseDir
protectedinherited
oofWordParser* dbConnect::mDefaultPrototypeParser
protectedinherited
char dbConnect_FServ::mFServInstanceName[32]
protected

Definition at line 138 of file oofFsrv.h.

void* dbConnect_FServ::mFServVars
protected

Definition at line 139 of file oofFsrv.h.

bool dbConnect_FServ::mHasBlobs
protected

Definition at line 134 of file oofFsrv.h.

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_FServ::mLockingState
protected

Definition at line 135 of file oofFsrv.h.

Referenced by isReadLocked(), and isWriteLocked().

unsigned int dbConnect_FServ::mNumFiles
protected

Definition at line 141 of file oofFsrv.h.

unsigned int dbConnect_FServ::mNumIndexes
protected

Definition at line 141 of file oofFsrv.h.

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

Definition at line 136 of file oofFsrv.h.

oofString dbConnect::mSchemaFileName
protectedinherited

Definition at line 1022 of file oof1.h.

Referenced by dbConnect_ctree::newConnection().

long dbConnect_FServ::mSuperFilNo
protected

Definition at line 137 of file oofFsrv.h.

OOF_Dictionary dbConnect::mTables
protectedinherited
bool dbConnect::mTempDatabase
protectedinherited
bool dbConnect_FServ::mUseSuperfile
protected

Definition at line 134 of file oofFsrv.h.

int dbConnect_FServ::mWriteLockApplications
protected

Definition at line 136 of file oofFsrv.h.

dbConnect_FServ* dbConnect_FServ::sActiveConnection
staticprotected

Definition at line 143 of file oofFsrv.h.

unsigned long dbConnect_FServ::sConnectionsOpened
staticprotected

Definition at line 142 of file oofFsrv.h.

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_FServ::sFileMode
static

Definition at line 145 of file oofFsrv.h.

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 file: