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 | e84fa8e3b8defe24a00e14ba046e8e71b438ce0b (patch) | |
tree | 2d17fab73f0bbb1a96f365e38ecbd63e033af36f /odb/mysql/database.ixx | |
parent | 47d344f31f7a1a980d807c142e0a36b09db3b1f3 (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/mysql/database.ixx')
-rw-r--r-- | odb/mysql/database.ixx | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/odb/mysql/database.ixx b/odb/mysql/database.ixx index 5791222..399fbdc 100644 --- a/odb/mysql/database.ixx +++ b/odb/mysql/database.ixx @@ -7,10 +7,20 @@ namespace odb { namespace mysql { - inline details::shared_ptr<database::connection_type> database:: + inline connection_ptr database:: connection () { - return factory_->connect (); + // Go through the virtual connection_() function instead of + // directly to allow overriding. + // + return connection_ptr ( + static_cast<mysql::connection*> (connection_ ())); + } + + inline transaction_impl* database:: + begin () + { + return connection ()->begin (); } } } |