diff options
Diffstat (limited to 'server/src/pracrodaopgsql.cc')
-rw-r--r-- | server/src/pracrodaopgsql.cc | 27 |
1 files changed, 4 insertions, 23 deletions
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 <config.h> +#ifndef WITHOUT_DB + #include <stdlib.h> #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, <fields...>, %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*/ |