From 3faf8e7a8aa2411f207fa09fe81982615d90a726 Mon Sep 17 00:00:00 2001 From: Constantin Michael Date: Wed, 11 May 2011 12:27:41 +0200 Subject: Implement database::execute --- odb/pgsql/error.cxx | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'odb/pgsql/error.cxx') diff --git a/odb/pgsql/error.cxx b/odb/pgsql/error.cxx index ba14b9a..f65cbee 100644 --- a/odb/pgsql/error.cxx +++ b/odb/pgsql/error.cxx @@ -74,6 +74,25 @@ namespace odb }; } + bool + is_good_result (PGresult* r, ExecStatusType* s) + { + if (r != 0) + { + ExecStatusType status (PQresultStatus (r)); + + if (s != 0) + *s = status; + + return + *s != PGRES_BAD_RESPONSE && + *s != PGRES_NONFATAL_ERROR && + *s != PGRES_FATAL_ERROR; + } + + return false; + } + void translate_result_error (connection& c, PGresult* r, @@ -84,8 +103,8 @@ namespace odb translate_result_error_ (c); else { - const char* ss = PQresultErrorField (r, PG_DIAG_SQLSTATE); - const char* m = PQresultErrorMessage (r); + const char* ss (PQresultErrorField (r, PG_DIAG_SQLSTATE)); + const char* m (PQresultErrorMessage (r)); if (clear_result) PQclear (r); -- cgit v1.1