aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-08-22 11:43:52 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-08-22 11:43:52 +0200
commitb536a5596073c6e253a8270d7da3280b23165e4f (patch)
tree8f3e540854be74a32e7e196e8afce97b0ec19cce
parentee570de4bd013fd2a4351d33d11539621f00bf57 (diff)
Add support for constructing delete_statement with native binding only
This is similar to what we do in select_statement.
-rw-r--r--odb/pgsql/statement.cxx18
-rw-r--r--odb/pgsql/statement.hxx9
2 files changed, 24 insertions, 3 deletions
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_;
};
}