From b536a5596073c6e253a8270d7da3280b23165e4f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 22 Aug 2011 11:43:52 +0200 Subject: Add support for constructing delete_statement with native binding only This is similar to what we do in select_statement. --- odb/pgsql/statement.cxx | 18 ++++++++++++++++-- odb/pgsql/statement.hxx | 9 ++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) (limited to 'odb') diff --git a/odb/pgsql/statement.cxx b/odb/pgsql/statement.cxx index f9a4fb7..26ae475 100644 --- a/odb/pgsql/statement.cxx +++ b/odb/pgsql/statement.cxx @@ -572,7 +572,20 @@ namespace odb binding& cond, native_binding& native_cond) : statement (conn, name, stmt, types, types_count), - cond_ (cond), + cond_ (&cond), + native_cond_ (native_cond) + { + } + + delete_statement:: + delete_statement (connection& conn, + const string& name, + const string& stmt, + const Oid* types, + size_t types_count, + native_binding& native_cond) + : statement (conn, name, stmt, types, types_count), + cond_ (0), native_cond_ (native_cond) { } @@ -580,7 +593,8 @@ namespace odb unsigned long long delete_statement:: execute () { - bind_param (native_cond_, cond_); + if (cond_ != 0) + bind_param (native_cond_, *cond_); result_ptr r (PQexecPrepared (conn_.handle (), name_.c_str (), diff --git a/odb/pgsql/statement.hxx b/odb/pgsql/statement.hxx index 3a25f5e..11e04b3 100644 --- a/odb/pgsql/statement.hxx +++ b/odb/pgsql/statement.hxx @@ -246,6 +246,13 @@ namespace odb binding& cond, native_binding& native_cond); + delete_statement (connection& conn, + const std::string& name, + const std::string& stmt, + const Oid* types, + std::size_t types_count, + native_binding& native_cond); + unsigned long long execute (); @@ -254,7 +261,7 @@ namespace odb delete_statement& operator= (const delete_statement&); private: - binding& cond_; + binding* cond_; native_binding& native_cond_; }; } -- cgit v1.1