From 417532e9def7d5568ec9804a65078f2b42707a4a Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 17 Feb 2009 12:07:03 +0000 Subject: Made the --with-db=no configure option actually compile without the db (even without an installed libpqxx). --- server/src/pracrodaopgsql.cc | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) (limited to 'server/src/pracrodaopgsql.cc') diff --git a/server/src/pracrodaopgsql.cc b/server/src/pracrodaopgsql.cc index 05cd46d..c2e65bc 100644 --- a/server/src/pracrodaopgsql.cc +++ b/server/src/pracrodaopgsql.cc @@ -36,9 +36,10 @@ * UPDATE transactions SET uid = oid; * INSERT INTO fieldnames (name, description, timestamp) VALUES ('journal.resume', 'Journal resume text', (SELECT EXTRACT(EPOCH FROM now())::integer)); */ - #include +#ifndef WITHOUT_DB + #include #include "debug.h" @@ -72,7 +73,6 @@ void PracroDAOPgsql::commitTransaction(std::string user, std::string cpr, Macro std::string macro = _macro.attributes["name"]; std::stringstream timestamp; timestamp << now; -#ifndef WITHOUT_DB std::string ts; try { pqxx::work W(*conn); @@ -126,15 +126,6 @@ void PracroDAOPgsql::commitTransaction(std::string user, std::string cpr, Macro } catch(std::exception &e) { PRACRO_ERR_LOG(db, "Query failed: %s: %s\n", e.what(), ts.c_str()); } -#else -#ifdef WITH_DEBUG - std::map< std::string, std::string >::iterator i = fields.begin(); - while(i != fields.end()) { - PRACRO_DEBUG(db, "Storing field '%s': '%s'\n", i->first, i->second); - i++; - } -#endif/*WITH_DEBUG*/ -#endif/*WITHOUT_DB*/ } @@ -165,7 +156,6 @@ Values PracroDAOPgsql::getLatestValues(std::string cpr, Macro *macro, Fieldnames if(!conn) PRACRO_DEBUG(db, "No pgsql connection\n"); Values values; -#ifndef WITHOUT_DB std::string query; std::stringstream soldest; soldest << oldest; try { @@ -220,11 +210,6 @@ Values PracroDAOPgsql::getLatestValues(std::string cpr, Macro *macro, Fieldnames } catch (std::exception &e) { PRACRO_ERR_LOG(db, "Query failed: %s: %s\n", e.what(), query.c_str()); } -#else -#ifdef WITH_DEBUG - PRACRO_DEBUG(db, "getLatestValues(%s, , %ld) -- not implemented without database...\n", cpr.c_str(), oldest); -#endif/*WITH_DEBUG*/ -#endif/*WITHOUT_DB*/ return values; } @@ -232,7 +217,6 @@ Values PracroDAOPgsql::getLatestValues(std::string cpr, Macro *macro, Fieldnames unsigned PracroDAOPgsql::nrOfCommits(std::string cpr, std::string macroname, time_t oldest) { -#ifndef WITHOUT_DB std::string query; std::stringstream soldest; soldest << oldest; try { @@ -254,11 +238,8 @@ unsigned PracroDAOPgsql::nrOfCommits(std::string cpr, std::string macroname, tim } catch (std::exception &e) { PRACRO_ERR_LOG(db, "Query failed: %s: %s\n", e.what(), query.c_str()); } -#else -#ifdef WITH_DEBUG - PRACRO_DEBUG(db, "Returning 0 commits without database\n"); -#endif/*WITH_DEBUG*/ -#endif/*WITHOUT_DB*/ + return 0; } +#endif/*WITHOUT_DB*/ -- cgit v1.2.3