From e09e7825369ec8217456065d31dbbbb992b7f1bb Mon Sep 17 00:00:00 2001 From: Cara Salter Date: Wed, 31 May 2023 20:15:08 -0400 Subject: meta: Use system libraries to compile Also: try to make pqxx not use local socket for connections (unsuccessful) Change-Id: I351fe1a405a7c204e1276a90da75ab3d32f51bdc --- src/db.cpp | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) (limited to 'src/db.cpp') diff --git a/src/db.cpp b/src/db.cpp index 120c9d4..038c06d 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -35,32 +35,11 @@ namespace db { /** * Connects to a postgres database, returns false if error **/ - pqxx::connection connect(const std::string &host, const std::string &user, const std::string &pass, const std::string &db, int port) { + pqxx::connection connect(const std::string cn_s) { std::lock_guard db_lock(db_mutex); - - std::string cn_s = "postgresql://"; - - if (!user.empty()) { - cn_s = cn_s + user; - } - if (!pass.empty() && !user.empty()) { - cn_s = cn_s + ":" + pass; - } - if ((!user.empty() || !pass.empty())) { - cn_s = cn_s + "@"; - } - - if (!host.empty()) { - cn_s = cn_s + "localhost"; - } - if (port != 0 && !host.empty()) { - cn_s = cn_s + ":" + std::to_string(port); - } - if (!db.empty()) { - cn_s = cn_s + "/" + db; - } + cout << cn_s << endl; sentry_value_t crumb = sentry_value_new_breadcrumb("default", "Started Database Connection"); sentry_value_set_by_key(crumb, "level", sentry_value_new_string("db")); -- cgit v1.2.3