diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-08-21 16:27:34 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-08-21 16:27:34 +0200 |
commit | 5694c0a4529334756f2b914ad67408df199551dc (patch) | |
tree | 38daa2e27d6049ca7a808af642eb82a29c9d2886 /odb/sqlite/connection.hxx | |
parent | 1bf4678c29b6e51396c18582b270254d1bd2cddc (diff) |
Add odb::connection class
This abstract class represents a connection to the database. One can
use it to start a transaction or to execute a native statement out
of a transaction.
Before we had concrete connection classes in the database runtime
libraries (e.g., odb::mysql::connection). Now these classes derive
from odb::connection.
Diffstat (limited to 'odb/sqlite/connection.hxx')
-rw-r--r-- | odb/sqlite/connection.hxx | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/odb/sqlite/connection.hxx b/odb/sqlite/connection.hxx index 3ae82e3..e069ce9 100644 --- a/odb/sqlite/connection.hxx +++ b/odb/sqlite/connection.hxx @@ -13,12 +13,14 @@ #include <memory> // std::auto_ptr #include <odb/forward.hxx> +#include <odb/connection.hxx> #include <odb/details/mutex.hxx> #include <odb/details/condition.hxx> #include <odb/details/shared-ptr.hxx> #include <odb/sqlite/version.hxx> #include <odb/sqlite/forward.hxx> +#include <odb/sqlite/transaction-impl.hxx> #include <odb/sqlite/details/export.hxx> namespace odb @@ -28,7 +30,10 @@ namespace odb class statement; class statement_cache; - class LIBODB_SQLITE_EXPORT connection: public details::shared_base + class connection; + typedef details::shared_ptr<connection> connection_ptr; + + class LIBODB_SQLITE_EXPORT connection: public odb::connection { public: typedef sqlite::statement_cache statement_cache_type; @@ -46,6 +51,22 @@ namespace odb } public: + virtual transaction_impl* + begin (); + + transaction_impl* + begin_immediate (); + + transaction_impl* + begin_exclusive (); + + public: + using odb::connection::execute; + + virtual unsigned long long + execute (const char* statement, std::size_t length); + + public: sqlite3* handle () { |