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

sqlite: Connection: Invert checks to fail early

Otherwise we end up deadlocking while acquiring the context. Might as
well fail harder & sooner
parent 0ac8f830
......@@ -140,11 +140,11 @@ void Connection::setPragma( Connection::Handle conn, const std::string& pragmaNa
void Connection::setForeignKeyEnabled( bool value )
{
// Ensure no transaction will be started during the pragma change
auto ctx = acquireWriteContext();
// Changing this pragma during a transaction is a no-op (silently ignored by
// sqlite), so ensure we're doing something usefull here:
assert( sqlite::Transaction::transactionInProgress() == false );
// Ensure no transaction will be started during the pragma change
auto ctx = acquireWriteContext();
setPragma( handle(), "foreign_keys", value ? "1" : "0" );
}
......
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