Browse Source

pass databases in daemon functions

main
Stefan Pranger 3 years ago
parent
commit
25b2594206
  1. 4
      calendar-daemon.cpp
  2. 1
      db/create.h

4
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<ical::IcalObject*> 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);
}

1
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;

Loading…
Cancel
Save