diff options
author | deva <deva> | 2009-02-17 12:07:03 +0000 |
---|---|---|
committer | deva <deva> | 2009-02-17 12:07:03 +0000 |
commit | 417532e9def7d5568ec9804a65078f2b42707a4a (patch) | |
tree | ef26189f18fe19a4b9a92a8b07b957688e6e0eca /server/src/pracrodaopgsql.cc | |
parent | 8dde5e5e15434eb83e8514220973e3cf8b56a393 (diff) |
Made the --with-db=no configure option actually compile without the db (even without an installed libpqxx).
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*/ |