aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--odb/mysql/connection.cxx5
-rw-r--r--odb/mysql/connection.hxx15
-rw-r--r--odb/mysql/container-statements.hxx12
-rw-r--r--odb/mysql/container-statements.txx2
-rw-r--r--odb/mysql/object-statements.hxx14
-rw-r--r--odb/mysql/object-statements.txx2
-rw-r--r--odb/mysql/result.txx3
7 files changed, 41 insertions, 12 deletions
diff --git a/odb/mysql/connection.cxx b/odb/mysql/connection.cxx
index 0b38d35..d87e578 100644
--- a/odb/mysql/connection.cxx
+++ b/odb/mysql/connection.cxx
@@ -17,8 +17,9 @@ namespace odb
namespace mysql
{
connection::
- connection (database& db)
- : handle_ (&mysql_),
+ connection (database_type& db)
+ : db_ (db),
+ handle_ (&mysql_),
active_ (0),
statement_cache_ (new statement_cache_type (*this))
{
diff --git a/odb/mysql/connection.hxx b/odb/mysql/connection.hxx
index 7696909..ca1268a 100644
--- a/odb/mysql/connection.hxx
+++ b/odb/mysql/connection.hxx
@@ -15,6 +15,7 @@
#include <odb/mysql/mysql.hxx>
#include <odb/mysql/version.hxx>
+#include <odb/mysql/forward.hxx>
#include <odb/details/shared-ptr.hxx>
@@ -31,12 +32,19 @@ namespace odb
{
public:
typedef mysql::statement_cache statement_cache_type;
-
- connection (database&);
+ typedef mysql::database database_type;
virtual
~connection ();
+ connection (database_type&);
+
+ database_type&
+ database ()
+ {
+ return db_;
+ }
+
public:
MYSQL*
handle ()
@@ -82,8 +90,11 @@ namespace odb
free_stmt_handles ();
private:
+ database_type& db_;
+
MYSQL mysql_;
MYSQL* handle_;
+
statement* active_;
std::auto_ptr<statement_cache_type> statement_cache_;
diff --git a/odb/mysql/container-statements.hxx b/odb/mysql/container-statements.hxx
index 322129f..4d23d5a 100644
--- a/odb/mysql/container-statements.hxx
+++ b/odb/mysql/container-statements.hxx
@@ -40,7 +40,15 @@ namespace odb
typedef mysql::select_statement select_statement_type;
typedef mysql::delete_statement delete_statement_type;
- container_statements (connection&);
+ typedef mysql::connection connection_type;
+
+ container_statements (connection_type&);
+
+ connection_type&
+ connection ()
+ {
+ return conn_;
+ }
// Functions.
//
@@ -129,7 +137,7 @@ namespace odb
container_statements& operator= (const container_statements&);
private:
- connection& conn_;
+ connection_type& conn_;
functions_type functions_;
cond_image_type cond_image_;
diff --git a/odb/mysql/container-statements.txx b/odb/mysql/container-statements.txx
index a4bb7e5..18d7831 100644
--- a/odb/mysql/container-statements.txx
+++ b/odb/mysql/container-statements.txx
@@ -15,7 +15,7 @@ namespace odb
template <typename T>
container_statements<T>::
- container_statements (connection& conn)
+ container_statements (connection_type& conn)
: conn_ (conn),
functions_ (this,
&traits::insert_one,
diff --git a/odb/mysql/object-statements.hxx b/odb/mysql/object-statements.hxx
index a16af88..ad51d05 100644
--- a/odb/mysql/object-statements.hxx
+++ b/odb/mysql/object-statements.hxx
@@ -29,17 +29,25 @@ namespace odb
public details::shared_base
{
public:
+ typedef mysql::connection connection_type;
+
+ connection_type&
+ connection ()
+ {
+ return conn_;
+ }
+
virtual
~object_statements_base ();
protected:
- object_statements_base (connection& conn)
+ object_statements_base (connection_type& conn)
: conn_ (conn)
{
}
protected:
- connection& conn_;
+ connection_type& conn_;
};
template <typename T>
@@ -59,7 +67,7 @@ namespace odb
typedef mysql::update_statement update_statement_type;
typedef mysql::delete_statement erase_statement_type;
- object_statements (connection&);
+ object_statements (connection_type&);
image_type&
image ()
diff --git a/odb/mysql/object-statements.txx b/odb/mysql/object-statements.txx
index 8b2dad1..553447b 100644
--- a/odb/mysql/object-statements.txx
+++ b/odb/mysql/object-statements.txx
@@ -15,7 +15,7 @@ namespace odb
template <typename T>
object_statements<T>::
- object_statements (connection& conn)
+ object_statements (connection_type& conn)
: object_statements_base (conn),
container_statement_cache_ (conn),
image_binding_ (image_bind_, object_traits::column_count),
diff --git a/odb/mysql/result.txx b/odb/mysql/result.txx
index f06ee46..931ecf9 100644
--- a/odb/mysql/result.txx
+++ b/odb/mysql/result.txx
@@ -27,7 +27,8 @@ namespace odb
current (T& x)
{
if (!this->end_)
- traits::init (x, statements_.image ());
+ traits::init (
+ x, statements_.image (), statements_.connection ().database ());
}
template <typename T>