Commit 21f72b5a authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

SqliteConnection: Fully initialize the connection before storing it.

Remove premature unlock, since we are no longer calling ourselves
recursively, so we won't deadlock anymore with this unlock missing.
parent 2a6924a1
......@@ -48,8 +48,6 @@ SqliteConnection::Handle SqliteConnection::getConn()
res = sqlite3_busy_timeout( dbConnection, 500 );
if ( res != SQLITE_OK )
LOG_WARN( "Failed to enable sqlite busy timeout" );
m_conns.emplace(std::this_thread::get_id(), ConnPtr( dbConnection, &sqlite3_close ) );
lock.unlock();
sqlite::Statement s( dbConnection, "PRAGMA foreign_keys = ON" );
s.execute();
while ( s.row() != nullptr )
......@@ -58,6 +56,7 @@ SqliteConnection::Handle SqliteConnection::getConn()
s.execute();
while ( s.row() != nullptr )
;
m_conns.emplace(std::this_thread::get_id(), ConnPtr( dbConnection, &sqlite3_close ) );
return dbConnection;
}
return it->second.get();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment