#include <dbfacade.h>
Public Member Functions | |
virtual | ~Database () |
virtual void | connect (const std::string &server, const std::string &username, const std::string &password, const std::string &dbname)=0 |
virtual void | execute (const std::string &statement)=0 |
virtual ResultPtr | sqlSelect (const std::string &statement, const bool allAtOnce=true)=0 |
virtual int | sqlInsert (const std::string &statement)=0 |
virtual int | sqlUpdate (const std::string &statement)=0 |
virtual bool | getFirstBoolean (const std::string &statement) |
virtual double | getFirstDouble (const std::string &statement) |
virtual int | getFirstInt (const std::string &statement) |
virtual std::string | getFirstString (const std::string &statement) |
virtual std::string | escape (const char *unescaped, const int size) const =0 |
Static Public Member Functions | |
static boost::shared_ptr < Database > | getDatabase (const std::string &identifier) |
Database::~Database | ( | ) | [virtual] |
static boost::shared_ptr<Database> dbfacade::Database::getDatabase | ( | const std::string & | identifier | ) | [static] |
A factory that returns the appropriate type of database.
virtual void dbfacade::Database::connect | ( | const std::string & | server, | |
const std::string & | username, | |||
const std::string & | password, | |||
const std::string & | dbname | |||
) | [pure virtual] |
Establishes a connection to a database.
Implemented in DatabaseMySQL, DatabasePostgreSQL, and DatabaseSQLite.
virtual void dbfacade::Database::execute | ( | const std::string & | statement | ) | [pure virtual] |
Called by sqlSelect, sqlInsert and sqlUpdate.
Implemented in DatabaseMySQL, DatabasePostgreSQL, and DatabaseSQLite.
virtual ResultPtr dbfacade::Database::sqlSelect | ( | const std::string & | statement, | |
const bool | allAtOnce = true | |||
) | [pure virtual] |
Returns the result of the select statement.
Implemented in DatabaseMySQL, DatabasePostgreSQL, and DatabaseSQLite.
virtual int dbfacade::Database::sqlInsert | ( | const std::string & | statement | ) | [pure virtual] |
MySQL:
Implemented in DatabaseMySQL, DatabasePostgreSQL, and DatabaseSQLite.
virtual int dbfacade::Database::sqlUpdate | ( | const std::string & | statement | ) | [pure virtual] |
Returns the number of affected rows.
Implemented in DatabaseMySQL, DatabasePostgreSQL, and DatabaseSQLite.
virtual bool dbfacade::Database::getFirstBoolean | ( | const std::string & | statement | ) | [virtual] |
Returns the first column of the first row of the result.
virtual double dbfacade::Database::getFirstDouble | ( | const std::string & | statement | ) | [virtual] |
Returns the first column of the first row of the result.
virtual int dbfacade::Database::getFirstInt | ( | const std::string & | statement | ) | [virtual] |
Returns the first column of the first row of the result.
virtual std::string dbfacade::Database::getFirstString | ( | const std::string & | statement | ) | [virtual] |
Returns the first column of the first row of the result.
virtual std::string dbfacade::Database::escape | ( | const char * | unescaped, | |
const int | size | |||
) | const [pure virtual] |
Replaces characters by escape sequences.
Implemented in DatabaseMySQL, DatabasePostgreSQL, and DatabaseSQLite.