From 9126281b53722115b2e8624632f2dd616f0c26a0 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 12 Oct 2012 17:24:44 +0200 Subject: Completion of prepared query support --- odb/mysql/statement.hxx | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'odb/mysql/statement.hxx') diff --git a/odb/mysql/statement.hxx b/odb/mysql/statement.hxx index 700a7f5..66717aa 100644 --- a/odb/mysql/statement.hxx +++ b/odb/mysql/statement.hxx @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -29,6 +30,8 @@ namespace odb class LIBODB_MYSQL_EXPORT statement: public odb::statement { public: + typedef mysql::connection connection_type; + virtual ~statement () = 0; @@ -41,6 +44,12 @@ namespace odb virtual const char* text () const; + virtual connection_type& + connection () + { + return conn_; + } + // Cancel the statement execution (e.g., result fetching) so // that another statement can be executed on the connection. // @@ -48,15 +57,15 @@ namespace odb cancel (); protected: - statement (connection&, const std::string& text); - statement (connection&, const char* text, bool copy_text); + statement (connection_type&, const std::string& text); + statement (connection_type&, const char* text, bool copy_text); private: void init (std::size_t text_size); protected: - connection& conn_; + connection_type& conn_; std::string text_copy_; const char* text_; auto_handle stmt_; @@ -68,22 +77,22 @@ namespace odb virtual ~select_statement (); - select_statement (connection& conn, + select_statement (connection_type& conn, const std::string& text, binding& param, binding& result); - select_statement (connection& conn, + select_statement (connection_type& conn, const char* text, binding& param, binding& result, bool copy_text = true); - select_statement (connection& conn, + select_statement (connection_type& conn, const std::string& text, binding& result); - select_statement (connection& conn, + select_statement (connection_type& conn, const char* text, binding& result, bool copy_text = true); @@ -176,11 +185,11 @@ namespace odb virtual ~insert_statement (); - insert_statement (connection& conn, + insert_statement (connection_type& conn, const std::string& text, binding& param); - insert_statement (connection& conn, + insert_statement (connection_type& conn, const char* text, binding& param, bool copy_text = true); @@ -209,11 +218,11 @@ namespace odb virtual ~update_statement (); - update_statement (connection& conn, + update_statement (connection_type& conn, const std::string& text, binding& param); - update_statement (connection& conn, + update_statement (connection_type& conn, const char* text, binding& param, bool copy_text = true); @@ -236,11 +245,11 @@ namespace odb virtual ~delete_statement (); - delete_statement (connection& conn, + delete_statement (connection_type& conn, const std::string& text, binding& param); - delete_statement (connection& conn, + delete_statement (connection_type& conn, const char* text, binding& param, bool copy_text = true); -- cgit v1.1