Skip to content

Commit 3cacf99

Browse files
committed
add additional information to SQLiteLogger
1 parent c65f358 commit 3cacf99

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/loggers/bt_sqlite_logger.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ SqliteLogger::SqliteLogger(const Tree& tree, std::filesystem::path const& filepa
2727
"state INTEGER NOT NULL,"
2828
"metadata VARCHAR );");
2929

30+
sqlite::Statement(*db_, "CREATE TABLE IF NOT EXISTS Nodes ("
31+
"session_id INTEGER NOT NULL, "
32+
"fullpath VARCHAR, "
33+
"uid INTEGER NOT NULL );");
34+
3035
sqlite::Statement(*db_, "CREATE TABLE IF NOT EXISTS Definitions ("
3136
"session_id INTEGER PRIMARY KEY AUTOINCREMENT, "
3237
"date TEXT NOT NULL,"
@@ -50,6 +55,16 @@ SqliteLogger::SqliteLogger(const Tree& tree, std::filesystem::path const& filepa
5055
{
5156
session_id_ = res.Get(0);
5257
}
58+
59+
for(const auto& subtree : tree.subtrees)
60+
{
61+
for(const auto& node : subtree->nodes)
62+
{
63+
sqlite::Statement(*db_, "INSERT INTO Nodes VALUES (?, ?, ?)", session_id_,
64+
node->fullPath(), node->UID());
65+
}
66+
}
67+
5368
writer_thread_ = std::thread(&SqliteLogger::writerLoop, this);
5469
}
5570

0 commit comments

Comments
 (0)