|
libdballe
7.7
|
Database connection. More...
#include <internals.h>
Public Member Functions | |
| ODBCConnection (const ODBCConnection &)=delete | |
| ODBCConnection (const ODBCConnection &&)=delete | |
| ODBCConnection & | operator= (const ODBCConnection &)=delete |
| void | connect (const char *dsn, const char *user, const char *password) |
| void | connect_url (const char *url) |
| void | connect_test () |
| void | driver_connect (const char *config) |
| std::string | driver_name () |
| std::string | driver_version () |
| void | get_info (SQLUSMALLINT info_type, SQLINTEGER &res) |
| void | set_autocommit (bool val) |
| void | exec (const std::string &query) |
| std::unique_ptr< Transaction > | transaction () override |
| Begin a transaction. More... | |
| std::unique_ptr< ODBCStatement > | odbcstatement (const std::string &query) |
| bool | has_table (const std::string &name) override |
| Check if the database contains a table. | |
| std::string | get_setting (const std::string &key) override |
| Get a value from the settings table. More... | |
| void | set_setting (const std::string &key, const std::string &value) override |
| Set a value in the settings table. More... | |
| void | drop_settings () override |
| Drop the settings table. | |
| void | drop_table_if_exists (const char *name) |
| Delete a table in the database if it exists, otherwise do nothing. | |
| void | drop_sequence_if_exists (const char *name) |
| Delete a sequence in the database if it exists, otherwise do nothing. | |
| int | get_last_insert_id () |
| Return LAST_INSERT_ID or LAST_INSER_ROWID or whatever is appropriate for the current database, if supported. More... | |
| void | add_datetime (Querybuf &qb, const Datetime &dt) const override |
| Format a datetime and add it to the querybuf. | |
Public Member Functions inherited from dballe::db::Connection | |
| const std::string & | get_url () const |
Data Fields | |
| SQLHDBC | od_conn |
| ODBC database connection. | |
| bool | connected |
| True if the connection is open. | |
| unsigned | server_quirks |
| Bitfield of quirks we should be aware of when using ODBC. | |
Data Fields inherited from dballe::db::Connection | |
| ServerType | server_type |
| Type of SQL server we are connected to. More... | |
Protected Member Functions | |
| void | init_after_connect () |
Protected Attributes | |
| ODBCStatement * | stm_last_insert_id |
| Precompiled LAST_INSERT_ID (or equivalent) SQL statement. | |
| int | m_last_insert_id |
| ID of the last autogenerated primary key. | |
Protected Attributes inherited from dballe::db::Connection | |
| std::string | url |
Additional Inherited Members | |
Static Public Member Functions inherited from dballe::db::Connection | |
| 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. | |
Database connection.
| int dballe::db::ODBCConnection::get_last_insert_id | ( | ) |
Return LAST_INSERT_ID or LAST_INSER_ROWID or whatever is appropriate for the current database, if supported.
If not supported, an exception is thrown.
|
overridevirtual |
Get a value from the settings table.
Returns the empty string if the table does not exist.
Implements dballe::db::Connection.
|
overridevirtual |
Set a value in the settings table.
The table is created if it does not exist.
Implements dballe::db::Connection.
|
overridevirtual |
Begin a transaction.
The transaction will be controller by the returned Transaction object, and will end when its destuctor is called.
Implements dballe::db::Connection.
1.8.9.1