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 backend for a single RAM-resident table. More...

#include <oofram.h>

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

Public Member Functions

void attachTable (dbTable *)
 
virtual void close ()
 
const oofStringconnectionName () const
 
void copyAllFrom (dbConnect *)
 
oofDirectorydatabaseDirectory () const
 
 dbConnect_ram (bool isTemporary=true)
 
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 *connectionName=0)
 
virtual void newConnection (const FSSpec &)
 
unsigned int numTables () const
 
virtual void openConnection (const char *connectionName=0)
 
virtual void openConnection (const FSSpec &)
 
virtual bool openOrCreateConnection (const char *connectionName=0)
 
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 *)
 
virtual bool usesSeparateStorageFiles () const
 
virtual void writeOOFSchema ()
 
virtual ~dbConnect_ram ()
 

Static Public Member Functions

static dbConnectcurrentlyConstructing ()
 
static bool fileExists (const char *fName)
 
static OOF_tableBackendjustMakeTableBackend (dbTable *)
 
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...
 
virtual OOF_tableBackendMakeTableBackend (dbTable *)
 
void OpenOrCreateStateTransition (bool inOpenedOrCreated)
 Manage state transitions for FinishOpenOrCreateConnection. More...
 
void SetupConnection (const OOF_String &connectionName)
 
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 backend for a single RAM-resident table.

See also
dbConnect_ram

Definition at line 26 of file oofram.h.

Constructor & Destructor Documentation

dbConnect_ram::dbConnect_ram ( bool  isTemporary = true)

Definition at line 36 of file oofram.cpp.

dbConnect_ram::~dbConnect_ram ( )
virtual

Member Function Documentation

void dbConnect::attachTable ( dbTable theTable)
inherited
void dbConnect_ram::close ( )
virtual

Implements dbConnect.

Reimplemented in dbConnect_ramp.

Definition at line 75 of file oofram.cpp.

References dbConnect::mOpen.

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_ram::enterReadLocking ( )
inlinevirtual

Implements dbConnect.

Definition at line 48 of file oofram.h.

virtual void dbConnect_ram::enterWriteLocking ( )
inlinevirtual

Implements dbConnect.

Definition at line 47 of file oofram.h.

virtual void dbConnect_ram::exitLocking ( )
inlinevirtual

Implements dbConnect.

Definition at line 46 of file oofram.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.

OOF_tableBackend * dbConnect_ram::justMakeTableBackend ( dbTable forTable)
static

Definition at line 168 of file oofram.cpp.

Referenced by MakeTableBackend().

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 newConnection(), openConnection(), and 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_tableBackend * dbConnect_ram::MakeTableBackend ( dbTable forTable)
protectedvirtual

Implements dbConnect.

Definition at line 155 of file oofram.cpp.

References OOF_Dictionary::count(), justMakeTableBackend(), and dbConnect::mTables.

oofString dbConnect::name ( ) const
virtualinherited

Reimplemented from OOF_PublicBase.

Definition at line 409 of file oof1.cpp.

References dbConnect::connectionName().

void dbConnect_ram::newConnection ( const char *  connectionName = 0)
virtual
void dbConnect_ram::newConnection ( const FSSpec &  inMacFSSpec)
virtual

Implements dbConnect.

Reimplemented in dbConnect_ramp.

Definition at line 119 of file oofram.cpp.

References newConnection().

unsigned int dbConnect::numTables ( ) const
inlineinherited
void dbConnect_ram::openConnection ( const char *  connectionName = 0)
virtual

Implements dbConnect.

Reimplemented in dbConnect_ramp.

Definition at line 94 of file oofram.cpp.

References dbConnect::MakeAllTablesValid(), and SetupConnection().

Referenced by openConnection().

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

Implements dbConnect.

Reimplemented in dbConnect_ramp.

Definition at line 126 of file oofram.cpp.

References openConnection().

bool dbConnect_ram::openOrCreateConnection ( const char *  connectionName = 0)
virtual

Reimplemented in dbConnect_ramp.

Definition at line 105 of file oofram.cpp.

References dbConnect::MakeAllTablesValid(), and SetupConnection().

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::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_ram::SetupConnection ( const OOF_String connectionName)
protected
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.

bool dbConnect::usesSeparateStorageFiles ( ) const
virtualinherited

Reimplemented in dbConnect_FServ, dbConnect_ctree, and dbConnect_dbase.

Definition at line 450 of file oof1.cpp.

Referenced by dbConnect::deleteStorage().

bool dbConnect::willTruncateTrailingSpaces ( )
inlinestaticinherited

Definition at line 1667 of file oof1.h.

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

void dbConnect_ram::writeOOFSchema ( )
virtual

Reimplemented from dbConnect.

Reimplemented in dbConnect_ramp.

Definition at line 149 of file oofram.cpp.

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