summaryrefslogtreecommitdiff
path: root/libpqpp/connection.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-12-02 21:26:31 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2015-12-02 21:26:31 +0000
commit1eaf76d711c2da04b925f381d77fbb5e4c7ed898 (patch)
treeb6d1ccd33036014e3485dcc4410ec32cd9c8bbaf /libpqpp/connection.cpp
parentPropergate connection error details into DB::Error and add test (diff)
downloadlibdbpp-postgresql-1eaf76d711c2da04b925f381d77fbb5e4c7ed898.tar.bz2
libdbpp-postgresql-1eaf76d711c2da04b925f381d77fbb5e4c7ed898.tar.xz
libdbpp-postgresql-1eaf76d711c2da04b925f381d77fbb5e4c7ed898.zip
Check for libpq thread safety, disable libcrypto init (fixes crashes with multiple ssl connections) add test
Diffstat (limited to 'libpqpp/connection.cpp')
-rw-r--r--libpqpp/connection.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/libpqpp/connection.cpp b/libpqpp/connection.cpp
index 51aac63..e47d846 100644
--- a/libpqpp/connection.cpp
+++ b/libpqpp/connection.cpp
@@ -3,9 +3,17 @@
#include "selectcommand.h"
#include "modifycommand.h"
#include <unistd.h>
+#include <boost/assert.hpp>
NAMEDFACTORY("postgresql", PQ::Connection, DB::ConnectionFactory);
+static void setup() __attribute__((constructor(101)));
+static void setup()
+{
+ BOOST_ASSERT(PQisthreadsafe() == 1);
+ PQinitOpenSSL(1, 0);
+}
+
static void
noNoticeProcessor(void *, const char *)
{