summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/configure.in4
-rw-r--r--server/src/admin_export.cc21
2 files changed, 17 insertions, 8 deletions
diff --git a/server/configure.in b/server/configure.in
index 19e703f..e65ac33 100644
--- a/server/configure.in
+++ b/server/configure.in
@@ -95,7 +95,9 @@ else
dnl ======================
dnl Check for libpqxx
dnl ======================
- PKG_CHECK_MODULES(PQXX, libpqxx >= 2.6.8)
+ PKG_CHECK_MODULES(PQXX, libpqxx >= 4.0,
+ [AC_DEFINE_UNQUOTED([USE_NEW_PQXX], [1], [Use new pqx api])],
+ [PKG_CHECK_MODULES(PQXX, libpqxx >= 2.6.8)] )
fi
dnl ======================
diff --git a/server/src/admin_export.cc b/server/src/admin_export.cc
index 0aa290c..3bdfcf6 100644
--- a/server/src/admin_export.cc
+++ b/server/src/admin_export.cc
@@ -41,6 +41,13 @@
#define SEP "\t"
+#ifdef USE_NEW_PQXX
+#include <pqxx/tuple.hxx>
+typedef pqxx::tuple tuple_t;
+#else
+typedef pqxx::result::tuple tuple_t;
+#endif
+
static std::string escape(std::string &str)
{
std::string out = "\"";
@@ -91,7 +98,7 @@ public:
" WHERE extract='true';");
pqxx::result::const_iterator ri = result.begin();
for(unsigned int r = 0; r < result.size(); r++) {
- pqxx::result::tuple tuple = result.at(r);
+ tuple_t tuple = result.at(r);
std::string name = tuple.at(0).c_str();
std::string caption = tuple.at(1).c_str();
addcell(name, caption);
@@ -166,7 +173,7 @@ static std::string do_export(Environment &env, std::string templ, bool *ok,
" WHERE extract='true';");
pqxx::result::const_iterator ri = result.begin();
for(unsigned int r = 0; r < result.size(); r++) {
- pqxx::result::tuple tuple = result.at(r);
+ tuple_t tuple = result.at(r);
std::string name = tuple.at(0).c_str();
filter.insert(name);
//printf("filter: '%s'\n", name.c_str());
@@ -209,7 +216,7 @@ static std::string do_export(Environment &env, std::string templ, bool *ok,
pqxx::result result = work.exec(q);
pqxx::result::const_iterator ri = result.begin();
for(unsigned int r = 0; r < result.size(); r++) {
- pqxx::result::tuple tuple = result.at(r);
+ tuple_t tuple = result.at(r);
std::string patientid = tuple.at(0).c_str();
std::string templ = tuple.at(1).c_str();
std::string version = tuple.at(2).c_str();
@@ -239,7 +246,7 @@ static std::string do_export(Environment &env, std::string templ, bool *ok,
" ORDER BY t.timestamp;");
pqxx::result::const_iterator ri = result.begin();
for(unsigned int r = 0; r < result.size(); r++) {
- pqxx::result::tuple tuple = result.at(r);
+ tuple_t tuple = result.at(r);
std::string name = tuple.at(0).c_str();
std::string value = tuple.at(1).c_str();
@@ -269,9 +276,9 @@ std::string admin_export(Environment &env, std::string templ, bool *ok,
}
#ifdef TEST_ADMIN_EXPORT
-//deps: environment.cc connectionpool.cc mutex.cc semaphore.cc configuration.cc entitylist.cc artefact.cc database.cc pracrodao.cc pracrodaotest.cc pracrodaopgsql.cc templatelist.cc macrolist.cc debug.cc macroheaderparser.cc exception.cc log.cc saxparser.cc templateheaderparser.cc versionstr.cc inotify.cc session.cc sessionserialiser.cc journal.cc journal_uploadserver.cc journal_commit.cc xml_encode_decode.cc sessionparser.cc fieldnamescanner.cc util.cc macroparser.cc templateparser.cc
-//cflags: -I.. -DWITHOUT_ARTEFACT $(PQXX_CFLAGS) $(EXPAT_CFLAGS)
-//libs: $(PQXX_LIBS) $(EXPAT_LIBS)
+//deps: environment.cc connectionpool.cc mutex.cc semaphore.cc configuration.cc entitylist.cc artefact.cc database.cc pracrodao.cc pracrodaotest.cc pracrodaopgsql.cc templatelist.cc macrolist.cc debug.cc macroheaderparser.cc exception.cc log.cc saxparser.cc templateheaderparser.cc versionstr.cc inotify.cc session.cc sessionserialiser.cc journal.cc journal_uploadserver.cc journal_commit.cc xml_encode_decode.cc sessionparser.cc fieldnamescanner.cc util.cc macroparser.cc templateparser.cc courselist.cc luascript.cc sessionheaderparser.cc courseparser.cc luautil.cc luapraxisd.cc praxisd.cc
+//cflags: -I.. -DWITHOUT_ARTEFACT $(PQXX_CFLAGS) $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS) $(LUA_CFLAGS) $(CURL_CFLAGS)
+//libs: $(PQXX_LIBS) $(EXPAT_LIBS) $(PTHREAD_LIBS) $(LUA_LIBS) $(CURL_LIBS)
#include "test.h"
TEST_BEGIN;