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

Database connection to a set of dBase-compatible files. More...

#include <oofdbase.h>

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

Public Member Functions

void attachTable (dbTable *)
 
virtual void close ()
 
const oofStringconnectionName () const
 
void copyAllFrom (dbConnect *)
 
oofDirectorydatabaseDirectory () const
 
 dbConnect_dbase (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...
 
bool isOpen () const
 
virtual oofString name () const
 
virtual void newConnection (const char *)
 
virtual void newConnection (const FSSpec &)
 
unsigned int numTables () const
 
virtual void openConnection (const char *)
 
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 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 useDbase3Memos ()
 
virtual bool usesSeparateStorageFiles () const
 
virtual void writeOOFSchema ()
 
virtual ~dbConnect_dbase ()
 

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 ()
 

Protected Types

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

Protected Member Functions

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

oofString mConnectionName
 
oofDirectorymDatabaseDir
 
oofWordParsermDefaultPrototypeParser
 
connectionFileStateT mFileState
 
bool mHidden
 
bool mInDeclarativePhase
 
bool mOpen
 
oofString mSchemaFileName
 
OOF_Dictionary mTables
 
bool mTempDatabase
 

Static Protected Attributes

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

Database connection to a set of dBase-compatible files.

See also
OOF_dbaseBackend

Definition at line 33 of file oofdbase.h.

Constructor & Destructor Documentation

dbConnect_dbase::dbConnect_dbase ( bool  isTemporary = false)

Definition at line 51 of file oofdbase.cpp.

dbConnect_dbase::~dbConnect_dbase ( )
virtual

Member Function Documentation

void dbConnect::attachTable ( dbTable theTable)
inherited
void dbConnect_dbase::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::deleteStorage ( )
virtualinherited
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_dbase::enterReadLocking ( )
inlinevirtual

Implements dbConnect.

Definition at line 55 of file oofdbase.h.

virtual void dbConnect_dbase::enterWriteLocking ( )
inlinevirtual

Implements dbConnect.

Definition at line 54 of file oofdbase.h.

virtual void dbConnect_dbase::exitLocking ( )
inlinevirtual

Implements dbConnect.

Definition at line 53 of file oofdbase.h.

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::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().

bool dbConnect::isOpen ( ) const
inlineinherited

Definition at line 1690 of file oof1.h.

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().

oofString dbConnect::name ( ) const
virtualinherited

Reimplemented from OOF_PublicBase.

Definition at line 409 of file oof1.cpp.

References dbConnect::connectionName().

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

Implements dbConnect.

Definition at line 165 of file oofdbase.cpp.

References dbConnect::mDatabaseDir, dbConnect::mOpen, and dbConnect::raise().

void dbConnect_dbase::newConnection ( const FSSpec &  inMacFSSpec)
virtual

Implements dbConnect.

Definition at line 207 of file oofdbase.cpp.

References dbConnect::mDatabaseDir, dbConnect::mOpen, and dbConnect::raise().

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

Implements dbConnect.

Definition at line 178 of file oofdbase.cpp.

References dbConnect::mDatabaseDir, dbConnect::mOpen, and dbConnect::raise().

void dbConnect_dbase::openConnection ( const FSSpec &  inMacFSSpec)
virtual

Implements dbConnect.

Definition at line 220 of file oofdbase.cpp.

References dbConnect::mDatabaseDir, dbConnect::mOpen, and dbConnect::raise().

bool dbConnect_dbase::openOrCreateConnection ( const char *  connectionName)
virtual

Definition at line 191 of file oofdbase.cpp.

References dbConnect::mDatabaseDir, dbConnect::mOpen, and dbConnect::raise().

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(), newConnection(), OOF_ctreeBackend::newRecord(), openConnection(), 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::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
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.

bool dbConnect::underConstruction ( )
inlinestaticinherited

Definition at line 1653 of file oof1.h.

void dbConnect_dbase::useDbase3Memos ( )

Definition at line 92 of file oofdbase.cpp.

bool dbConnect_dbase::usesSeparateStorageFiles ( ) const
virtual

Reimplemented from dbConnect.

Definition at line 85 of file oofdbase.cpp.

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

oofString dbConnect::mConnectionName
protectedinherited
oofDirectory* dbConnect::mDatabaseDir
protectedinherited
oofWordParser* dbConnect::mDefaultPrototypeParser
protectedinherited
connectionFileStateT dbConnect::mFileState
protectedinherited
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.

bool dbConnect::mOpen
protectedinherited
oofString dbConnect::mSchemaFileName
protectedinherited

Definition at line 1022 of file oof1.h.

Referenced by dbConnect_ctree::newConnection().

OOF_Dictionary dbConnect::mTables
protectedinherited
bool dbConnect::mTempDatabase
protectedinherited
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().

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: