aboutsummaryrefslogtreecommitdiff
path: root/odb/pgsql/statement.cxx
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-05-19 17:08:03 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-05-19 17:08:03 +0200
commit0b762135ae0e28fcda69d58523364aa8bef9637a (patch)
treeb20ec744a62638e1c248b9e100c373e75f3fcedc /odb/pgsql/statement.cxx
parente4e17881e64175352f1e1d8d0159039f7115a7a0 (diff)
Add update_statement
Diffstat (limited to 'odb/pgsql/statement.cxx')
-rw-r--r--odb/pgsql/statement.cxx44
1 files changed, 44 insertions, 0 deletions
diff --git a/odb/pgsql/statement.cxx b/odb/pgsql/statement.cxx
index efd7f8e..f3425a6 100644
--- a/odb/pgsql/statement.cxx
+++ b/odb/pgsql/statement.cxx
@@ -128,6 +128,50 @@ namespace odb
return static_cast<unsigned long long> (oid_);
}
+ //
+ // update_statement
+ //
+
+ update_statement::
+ ~update_statement ()
+ {
+ }
+
+ update_statement::
+ update_statement (connection& conn,
+ const string& name,
+ const string& stmt,
+ const Oid* types,
+ size_t n,
+ native_binding& cond,
+ native_binding& data)
+ : statement (conn, name, stmt, types, n),
+ cond_ (cond),
+ data_ (data)
+ {
+ }
+
+ void update_statement::
+ execute ()
+ {
+ result_ptr r (PQexecPrepared (conn_.handle (),
+ name_.c_str (),
+ cond_.count,
+ cond_.values,
+ cond_.lengths,
+ cond_.formats,
+ 1));
+
+ PGresult* h (r.get ());
+
+ if (!is_good_result (h))
+ translate_error (conn_, h);
+
+ const char* s (PQcmdTuples (h));
+
+ if (s[0] == '0')
+ throw object_not_persistent ();
+ }
//
// delete_statement