From 25b259420647708e69ae13781f4abf01ecf8edff Mon Sep 17 00:00:00 2001 From: Stefan Pranger Date: Tue, 29 Jun 2021 16:34:43 +0200 Subject: [PATCH] pass databases in daemon functions --- calendar-daemon.cpp | 4 ++-- db/create.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/calendar-daemon.cpp b/calendar-daemon.cpp index 8f874a3..ed89b38 100644 --- a/calendar-daemon.cpp +++ b/calendar-daemon.cpp @@ -26,7 +26,7 @@ sql::Database* init_database(std::string calendar) { return db::init(calendar + ".db"); } -void update_database(std::string directory, const sql::Database *db) { +void update_database(std::string directory, sql::Database *db) { std::vector objects = util::parse_cal_dir(directory); for(auto const& obj : objects) { if(obj->empty()) continue; @@ -34,7 +34,7 @@ void update_database(std::string directory, const sql::Database *db) { } } -void do_heartbeat(std::string directory, const sql::Database *db) { +void do_heartbeat(std::string directory, sql::Database *db) { util::notify("Updating files from " + directory, ""); update_database(directory, db); } diff --git a/db/create.h b/db/create.h index 6e901f9..e37d1bc 100644 --- a/db/create.h +++ b/db/create.h @@ -9,7 +9,6 @@ namespace db { sql::Database* db = new sql::Database(name, SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE); DEBUG << "SQLite database file '" << db->getFilename().c_str() << "' opened successfully\n"; - Schema* schema = new Schema(db); schema->run_migrations(); return db;