libdballe  7.7
Public Member Functions | Static Public Member Functions | Data Fields | Protected Attributes
dballe::db::Connection Class Referenceabstract
Inheritance diagram for dballe::db::Connection:
dballe::db::MySQLConnection dballe::db::ODBCConnection dballe::db::PostgreSQLConnection dballe::db::SQLiteConnection

Public Member Functions

const std::string & get_url () const
 
virtual std::unique_ptr< Transactiontransaction ()=0
 Begin a transaction. More...
 
virtual bool has_table (const std::string &name)=0
 Check if the database contains a table.
 
virtual std::string get_setting (const std::string &key)=0
 Get a value from the settings table. More...
 
virtual void set_setting (const std::string &key, const std::string &value)=0
 Set a value in the settings table. More...
 
virtual void drop_settings ()=0
 Drop the settings table.
 
virtual void add_datetime (Querybuf &qb, const Datetime &dt) const
 Format a datetime and add it to the querybuf.
 

Static Public Member Functions

static std::unique_ptr< Connectioncreate_from_url (const char *url)
 Create a new connection from a URL.
 
static std::unique_ptr< Connectioncreate_from_url (const std::string &url)
 Create a new connection from a URL.
 

Data Fields

ServerType server_type
 Type of SQL server we are connected to. More...
 

Protected Attributes

std::string url
 

Member Function Documentation

virtual std::string dballe::db::Connection::get_setting ( const std::string &  key)
pure virtual

Get a value from the settings table.

Returns the empty string if the table does not exist.

Implemented in dballe::db::PostgreSQLConnection, dballe::db::MySQLConnection, dballe::db::ODBCConnection, and dballe::db::SQLiteConnection.

virtual void dballe::db::Connection::set_setting ( const std::string &  key,
const std::string &  value 
)
pure virtual

Set a value in the settings table.

The table is created if it does not exist.

Implemented in dballe::db::PostgreSQLConnection, dballe::db::MySQLConnection, dballe::db::ODBCConnection, and dballe::db::SQLiteConnection.

virtual std::unique_ptr<Transaction> dballe::db::Connection::transaction ( )
pure virtual

Begin a transaction.

The transaction will be controller by the returned Transaction object, and will end when its destuctor is called.

Implemented in dballe::db::PostgreSQLConnection, dballe::db::MySQLConnection, dballe::db::ODBCConnection, and dballe::db::SQLiteConnection.

Field Documentation

ServerType dballe::db::Connection::server_type

Type of SQL server we are connected to.

Use this to tell which SQL dialect to use, in case standard SQL behaviour is not enough


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