libdballe
7.19
|
Public Member Functions | |
const std::string & | get_url () const |
virtual std::unique_ptr< Transaction > | transaction ()=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. | |
virtual void | execute (const std::string &query)=0 |
Execute a query without reading its results. | |
virtual void | explain (const std::string &query, FILE *out)=0 |
Format and print the EXPLAIN output for the query to the given file. | |
Static Public Member Functions | |
static std::unique_ptr< Connection > | create_from_url (const char *url) |
Create a new connection from a URL. | |
static std::unique_ptr< Connection > | create_from_url (const std::string &url) |
Create a new connection from a URL. | |
Public Attributes | |
ServerType | server_type |
Type of SQL server we are connected to. More... | |
Protected Attributes | |
std::string | url |
bool | profile = false |
unsigned | profile_query_count = 0 |
|
pure virtual |
Get a value from the settings table.
Returns the empty string if the table does not exist.
Implemented in dballe::sql::PostgreSQLConnection, dballe::sql::MySQLConnection, and dballe::sql::SQLiteConnection.
|
pure virtual |
Set a value in the settings table.
The table is created if it does not exist.
Implemented in dballe::sql::PostgreSQLConnection, dballe::sql::MySQLConnection, and dballe::sql::SQLiteConnection.
|
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::sql::PostgreSQLConnection, dballe::sql::MySQLConnection, and dballe::sql::SQLiteConnection.
ServerType dballe::sql::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