For the first time dispatcher test is working... though there is still
some instability with sqlite3. Sometimes complains about "Library
routine called out of sequence" when writing...
diff --git a/src/object-db.cc b/src/object-db.cc
index fe00225..84c6ae8 100644
--- a/src/object-db.cc
+++ b/src/object-db.cc
@@ -50,6 +50,8 @@
fs::path actualFolder = folder / "objects" / hash.substr (0, 2);
fs::create_directories (actualFolder);
+ _LOG_DEBUG ("Open " << (actualFolder / hash.substr (2, hash.size () - 2)));
+
int res = sqlite3_open((actualFolder / hash.substr (2, hash.size () - 2)).c_str (), &m_db);
if (res != SQLITE_OK)
{
@@ -65,10 +67,12 @@
res = sqlite3_exec (m_db, INIT_DATABASE.c_str (), NULL, NULL, &errmsg);
if (res != SQLITE_OK && errmsg != 0)
{
- // std::cerr << "DEBUG: " << errmsg << std::endl;
+ _LOG_DEBUG (errmsg);
sqlite3_free (errmsg);
}
+ // _LOG_DEBUG ("open db");
+
willStartSave ();
}
@@ -114,6 +118,7 @@
{
didStopSave ();
+ // _LOG_DEBUG ("close db");
int res = sqlite3_close (m_db);
if (res != SQLITE_OK)
{
@@ -137,6 +142,7 @@
sqlite3_bind_blob (stmt, 3, &data[0], data.size (), SQLITE_STATIC);
sqlite3_step (stmt);
+ _LOG_DEBUG ("After saving object: " << sqlite3_errmsg (m_db));
sqlite3_finalize (stmt);
}
@@ -188,10 +194,12 @@
ObjectDb::willStartSave ()
{
sqlite3_exec (m_db, "BEGIN TRANSACTION;", 0,0,0);
+ // _LOG_DEBUG ("Open transaction: " << sqlite3_errmsg (m_db));
}
void
ObjectDb::didStopSave ()
{
sqlite3_exec (m_db, "END TRANSACTION;", 0,0,0);
+ // _LOG_DEBUG ("Close transaction: " << sqlite3_errmsg (m_db));
}