aboutsummaryrefslogtreecommitdiff
path: root/odb/pgsql/connection.cxx
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-07-14 10:15:03 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-07-14 23:01:49 +0200
commit9fb98837b7661aa034e68b2cc9bbf869a9a6ba6b (patch)
tree1b995d16ca0a852498aa58e031ac239185a48da7 /odb/pgsql/connection.cxx
parentdebdd3fa1bcf3c003636476484064ef919bc4d62 (diff)
Forbid connection to database if server integer_datetimes is off
Diffstat (limited to 'odb/pgsql/connection.cxx')
-rw-r--r--odb/pgsql/connection.cxx8
1 files changed, 5 insertions, 3 deletions
diff --git a/odb/pgsql/connection.cxx b/odb/pgsql/connection.cxx
index fb1ea26..b4790b0 100644
--- a/odb/pgsql/connection.cxx
+++ b/odb/pgsql/connection.cxx
@@ -3,7 +3,8 @@
// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
-#include <new> // std::bad_alloc
+#include <new> // std::bad_alloc
+#include <cstring> // std::strcmp
#include <string>
#include <odb/pgsql/database.hxx>
@@ -48,8 +49,9 @@ namespace odb
// Establish whether date/time values are represented as
// 8-byte integers.
//
- integer_datetimes_ =
- *PQparameterStatus (handle_, "integer_datetimes") == '1';
+ if (strcmp (PQparameterStatus (handle_, "integer_datetimes"), "on") != 0)
+ throw database_exception ("unsupported binary format for PostgreSQL "
+ "date-time SQL types");
}
connection::