summaryrefslogtreecommitdiff
path: root/libodb-pgsql/odb/pgsql/error.ixx
diff options
context:
space:
mode:
Diffstat (limited to 'libodb-pgsql/odb/pgsql/error.ixx')
-rw-r--r--libodb-pgsql/odb/pgsql/error.ixx31
1 files changed, 31 insertions, 0 deletions
diff --git a/libodb-pgsql/odb/pgsql/error.ixx b/libodb-pgsql/odb/pgsql/error.ixx
new file mode 100644
index 0000000..6a010aa
--- /dev/null
+++ b/libodb-pgsql/odb/pgsql/error.ixx
@@ -0,0 +1,31 @@
+// file : odb/pgsql/error.ixx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+namespace odb
+{
+ namespace pgsql
+ {
+ inline bool
+ is_good_result (PGresult* r, ExecStatusType* s)
+ {
+ if (r != 0)
+ {
+ ExecStatusType status (PQresultStatus (r));
+
+ if (s != 0)
+ *s = status;
+
+ return
+ status != PGRES_BAD_RESPONSE
+ && status != PGRES_NONFATAL_ERROR
+ && status != PGRES_FATAL_ERROR
+#ifdef LIBPQ_HAS_PIPELINING
+ && status != PGRES_PIPELINE_ABORTED
+#endif
+ ;
+ }
+
+ return false;
+ }
+ }
+}