Skip to content

Commit

Permalink
add additional information to SQLiteLogger
Browse files Browse the repository at this point in the history
  • Loading branch information
facontidavide committed Apr 12, 2024
1 parent c65f358 commit 3cacf99
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/loggers/bt_sqlite_logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ SqliteLogger::SqliteLogger(const Tree& tree, std::filesystem::path const& filepa
"state INTEGER NOT NULL,"
"metadata VARCHAR );");

sqlite::Statement(*db_, "CREATE TABLE IF NOT EXISTS Nodes ("
"session_id INTEGER NOT NULL, "
"fullpath VARCHAR, "
"uid INTEGER NOT NULL );");

sqlite::Statement(*db_, "CREATE TABLE IF NOT EXISTS Definitions ("
"session_id INTEGER PRIMARY KEY AUTOINCREMENT, "
"date TEXT NOT NULL,"
Expand All @@ -50,6 +55,16 @@ SqliteLogger::SqliteLogger(const Tree& tree, std::filesystem::path const& filepa
{
session_id_ = res.Get(0);
}

for(const auto& subtree : tree.subtrees)
{
for(const auto& node : subtree->nodes)
{
sqlite::Statement(*db_, "INSERT INTO Nodes VALUES (?, ?, ?)", session_id_,
node->fullPath(), node->UID());
}
}

writer_thread_ = std::thread(&SqliteLogger::writerLoop, this);
}

Expand Down

0 comments on commit 3cacf99

Please sign in to comment.