#include <pqdataprovider.h>
Public Member Functions | |
PqDataProvider (void) throw () | |
Constructor. | |
~PqDataProvider (void) throw () | |
Destructor. | |
DbBackends | getDbBackend (void) const throw () |
Get name of the database backend. | |
void | connect (const std::string &dbName, const std::string &userName, const std::string &password) |
Create a connection to the database. | |
const RecordSet & | execSql (const std::string &sql, const bool refresh=false) |
Execute a SQL query. | |
void | disconnect (void) |
Close the connection to the database. |
Definition at line 37 of file pqdataprovider.h.
DbBackends dal::PqDataProvider::getDbBackend | ( | void | ) | const throw () [virtual] |
Get name of the database backend.
Get the database backend name.
Implements dal::DataProvider.
Definition at line 55 of file pqdataprovider.cpp.
void dal::PqDataProvider::connect | ( | const std::string & | dbName, | |
const std::string & | userName, | |||
const std::string & | password | |||
) |
Create a connection to the database.
dbName | the database name. | |
userName | the user name. | |
password | the user password. |
DbConnectionFailure | if unsuccessful connection. |
Definition at line 66 of file pqdataprovider.cpp.
References dal::DataProvider::mDbName, and dal::DataProvider::mIsConnected.
const RecordSet & dal::PqDataProvider::execSql | ( | const std::string & | sql, | |
const bool | refresh = false | |||
) | [virtual] |
Execute a SQL query.
sql | the SQL query. | |
refresh | if true, refresh the cache (default = false). |
DbSqlQueryExecFailure | if unsuccessful execution. | |
std::runtime_error | if trying to query a closed database. |
Implements dal::DataProvider.
Definition at line 98 of file pqdataprovider.cpp.
References dal::RecordSet::add(), dal::RecordSet::clear(), dal::DataProvider::mIsConnected, dal::DataProvider::mRecordSet, dal::DataProvider::mSql, and dal::RecordSet::setColumnHeaders().
void dal::PqDataProvider::disconnect | ( | void | ) | [virtual] |
Close the connection to the database.
Close connection to database.
DbDisconnectionFailure | if unsuccessful disconnection. |
Implements dal::DataProvider.
Definition at line 149 of file pqdataprovider.cpp.
References dal::DataProvider::mIsConnected.
Referenced by ~PqDataProvider().