Public Types | Public Member Functions | Protected Attributes
DtDatabaseInterface Class Reference

DtDatabaseInterface is an interface object accessing and modifying a database. More...

+ Collaboration diagram for DtDatabaseInterface:

List of all members.

Public Types

enum  ConditionOperator {
  Equals,
  NotEquals
}
enum  MergeOperator {
  And,
  Or
}

Public Member Functions

 DtDatabaseInterface (const DtDatabaseDriver *databaseDriver)
 Constructor.
virtual ~DtDatabaseInterface ()
 Destructor.
DtDatabaseParameterscreateDefaultParameters () const
 Create the default parameters.
virtual bool connect (DtDatabaseParameters *params, bool useMaster)
 Connect to a database through the given DSN as userName (Note: if we want to support real user acts on the database server, this will need to be extended to include a password as well.
virtual bool disconnect ()
 Disconnect from the currently connected database.
virtual unsigned int maximumColumnWidth ()
 Get the current maximum supported column width.
virtual bool executeCommand (const DtString &sqlCommand)
 Execute the given SQL command.
virtual bool createDatabase (const DtString &databaseName)
 Request the creation of a database (currently, you must be connected to a master database to perform this operation)
virtual bool deleteDatabase (const DtString &databaseName)
 Request the creation of a database, if it exists (currently, you must be connected to a master database to perform this operation)
virtual bool createDataSourceName (DtDatabaseParameters *params, bool useMaster)
 Create a DSN.
virtual bool createTable (const DtDatabaseTable &tableDef, bool deleteIfExists)
 Create a table in the currently connected database as described by tableDef.
virtual bool insertRow (const DtDatabaseTable &tableDef)
 Insert the row of data currently contained in tableDef.
virtual bool updateRow (const DtDatabaseTable &tableDef, const std::vector< DtString > &columnsToSet, const DtString &whereCondition)
 Update a row using the table settings, the columns to set, and the condition.
virtual DtString createConditionString (const DtDatabaseColumn &column, const DtString &columnValue, ConditionOperator anOperator)
 Generate a condition string from a column and a value.
virtual DtString combineConditionStrings (const DtString &conditionOne, const DtString &conditionTwo, MergeOperator anOperator)
 Generate a condition string from two existing conditions.
void setIsMasterDSN (bool yesNo)
 Set/Get the current value of the "Is Master DSN" flag.
bool isMasterDSN () const
void setCreateDsnFailed (bool yesNo)
 Set/Get the current value of the "Create DSN Failed" flag.
bool createDsnFailed () const

Protected Attributes

const DtDatabaseDrivermyDriver
DtDatabaseEnvironmentmyEnvironment
DtDatabaseConnectionmyConnection
DtDatabaseCommandProcessormyCommandProcessor
DtDatabaseCommandFactorymyCommandFactory
bool myIsMaster
 Did we create the environment and connection objects?
bool myCreateDsnFailed

Detailed Description

DtDatabaseInterface is an interface object accessing and modifying a database.


Constructor & Destructor Documentation

DtDatabaseInterface::DtDatabaseInterface ( const DtDatabaseDriver databaseDriver) [explicit]

Constructor.

Exceptions:
DtInvalidInput,ifthe database driver is null.

Member Function Documentation

virtual bool DtDatabaseInterface::connect ( DtDatabaseParameters params,
bool  useMaster 
) [virtual]

Connect to a database through the given DSN as userName (Note: if we want to support real user acts on the database server, this will need to be extended to include a password as well.

Username and passwd could be command line args or mtl parameters (?))

virtual bool DtDatabaseInterface::createDataSourceName ( DtDatabaseParameters params,
bool  useMaster 
) [virtual]

Create a DSN.

Note that both the DSN and database name are in the config strings, which are ODBC driver-type specific.

virtual bool DtDatabaseInterface::insertRow ( const DtDatabaseTable tableDef) [virtual]

Insert the row of data currently contained in tableDef.

If not called with a table argument that implements something useful for genValueString(), this will probably result in an SQL error


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

Document ID: Generated on Tue Oct 11 19:41:03 EDT 2011 from SVN revision 107422
Copyright © 2005-2011 VT MÄK Inc. All Rights Reserved (www.mak.com)