diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-08-10 11:17:52 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-08-10 11:17:52 +0200 |
commit | 0a589394a09ce5b3f16d902d657710a2886cc2fc (patch) | |
tree | 08f5bfa47a0d07b0dc20352706342e17f277759f /odb/mysql/statement.hxx | |
parent | c67f076c75a36877ce142dc43a1ed2292ab8117a (diff) |
Add query support
Diffstat (limited to 'odb/mysql/statement.hxx')
-rw-r--r-- | odb/mysql/statement.hxx | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/odb/mysql/statement.hxx b/odb/mysql/statement.hxx index b635975..ec79b67 100644 --- a/odb/mysql/statement.hxx +++ b/odb/mysql/statement.hxx @@ -48,6 +48,12 @@ namespace odb virtual ~statement () = 0; + // Cancel the statement execution (e.g., result fetching) so + // that another statement can be executed on the connection. + // + virtual void + cancel (); + protected: statement (connection&); @@ -56,6 +62,49 @@ namespace odb MYSQL_STMT* stmt_; }; + class query_statement: public statement + { + public: + virtual + ~query_statement (); + + query_statement (connection& conn, + const std::string& query, + binding& image, + MYSQL_BIND* parameters); + enum result + { + success, + no_data, + truncated + }; + + void + execute (); + + result + fetch (); + + void + refetch (); + + void + free_result (); + + virtual void + cancel (); + + private: + query_statement (const query_statement&); + query_statement& operator= (const query_statement&); + + private: + binding& image_; + std::size_t image_version_; + + MYSQL_BIND* parameters_; + }; + class insert_statement: public statement { public: @@ -107,6 +156,8 @@ namespace odb void free_result (); + void + cancel (); private: select_statement (const select_statement&); @@ -279,6 +330,10 @@ namespace odb } private: + object_statements (const object_statements&); + object_statements& operator= (const object_statements&); + + private: // The last element is the id parameter. The update statement // depends on this being one contiguous arrays. // |