aboutsummaryrefslogtreecommitdiff
path: root/odb/pgsql/error.cxx
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-05-11 12:27:41 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-05-12 11:27:57 +0200
commit3faf8e7a8aa2411f207fa09fe81982615d90a726 (patch)
tree8b6cf5f11362a80e4de979ca5f4e4de2b8a4078f /odb/pgsql/error.cxx
parent4e955852b9d59338a5bb50facc1594e97b8ca2d8 (diff)
Implement database::execute
Diffstat (limited to 'odb/pgsql/error.cxx')
-rw-r--r--odb/pgsql/error.cxx23
1 files changed, 21 insertions, 2 deletions
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);