dal::DataProvider Class Reference

#include <dataprovider.h>

Inheritance diagram for dal::DataProvider:

dal::MySqlDataProvider dal::PqDataProvider dal::SqLiteDataProvider List of all members.

Detailed Description

An abstract data provider.

Notes:

Limitations:

Definition at line 58 of file dataprovider.h.

Public Member Functions

 DataProvider (void) throw ()
 Constructor.
virtual ~DataProvider (void) throw ()
 Destructor.
bool isConnected (void) const throw ()
 Get the connection status.
virtual DbBackends getDbBackend (void) const =0 throw ()
 Get the name of the database backend.
virtual void connect (const std::string &dbName, const std::string &userName, const std::string &password)=0
 Create a connection to the database.
virtual const RecordSetexecSql (const std::string &sql, const bool refresh=false)=0
 Execute a SQL query.
virtual void disconnect (void)=0
 Close the connection to the database.
std::string getDbName (void)
 Get the DataBase Name.

Protected Attributes

std::string mDbName
 the database name
bool mIsConnected
 the connection status
std::string mSql
 cache the last SQL query
RecordSet mRecordSet
 cache the result of the last SQL query


Constructor & Destructor Documentation

dal::DataProvider::DataProvider void   )  throw ()
 

Constructor.

Definition at line 33 of file dataprovider.cpp.

dal::DataProvider::~DataProvider void   )  throw () [virtual]
 

Destructor.

Definition at line 45 of file dataprovider.cpp.


Member Function Documentation

virtual void dal::DataProvider::connect const std::string &  dbName,
const std::string &  userName,
const std::string &  password
[pure virtual]
 

Create a connection to the database.

Parameters:
dbName the database name.
userName the user name.
password the user password.
Exceptions:
DbConnectionFailure if unsuccessful connection.

Implemented in dal::MySqlDataProvider, dal::PqDataProvider, and dal::SqLiteDataProvider.

virtual void dal::DataProvider::disconnect void   )  [pure virtual]
 

Close the connection to the database.

Exceptions:
DbDisconnectionFailure if unsuccessful disconnection.

Implemented in dal::MySqlDataProvider, dal::PqDataProvider, and dal::SqLiteDataProvider.

virtual const RecordSet& dal::DataProvider::execSql const std::string &  sql,
const bool  refresh = false
[pure virtual]
 

Execute a SQL query.

Parameters:
sql the SQL query.
refresh if true, refresh the cache (default = false).
Returns:
a recordset.
Exceptions:
DbSqlQueryExecFailure if unsuccessful execution.
std::runtime_error if trying to query a closed database.

Implemented in dal::MySqlDataProvider, dal::PqDataProvider, and dal::SqLiteDataProvider.

virtual DbBackends dal::DataProvider::getDbBackend void   )  const throw () [pure virtual]
 

Get the name of the database backend.

Returns:
the database backend name.

Implemented in dal::MySqlDataProvider, dal::PqDataProvider, and dal::SqLiteDataProvider.

std::string dal::DataProvider::getDbName void   ) 
 

Get the DataBase Name.

Definition at line 66 of file dataprovider.cpp.

bool dal::DataProvider::isConnected void   )  const throw ()
 

Get the connection status.

Returns:
true if connected.

Definition at line 56 of file dataprovider.cpp.


Member Data Documentation

std::string dal::DataProvider::mDbName [protected]
 

the database name

Definition at line 144 of file dataprovider.h.

bool dal::DataProvider::mIsConnected [protected]
 

the connection status

Definition at line 145 of file dataprovider.h.

RecordSet dal::DataProvider::mRecordSet [protected]
 

cache the result of the last SQL query

Definition at line 147 of file dataprovider.h.

std::string dal::DataProvider::mSql [protected]
 

cache the last SQL query

Definition at line 146 of file dataprovider.h.


The documentation for this class was generated from the following files:
Generated on Fri Mar 30 15:39:19 2007 for TMW Server by  doxygen 1.3.9.1