Skip to content

Commit

Permalink
Again trying to solve the “database is locked” problem for SQLite
Browse files Browse the repository at this point in the history
Change transaction mode for multithreaded mode.
  • Loading branch information
MioVisman committed Apr 7, 2023
1 parent c036b7f commit 48c549c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion include/dblayer/sqlite3.php
Expand Up @@ -77,7 +77,10 @@ function start_transaction()
{
++$this->in_transaction;

return ($this->link_id->exec('BEGIN TRANSACTION')) ? true : false;
if (defined('FORUM_SQLITE3_BUSY_TIMEOUT') && defined('FORUM_SQLITE3_WAL_ON'))
return $this->link_id->exec('BEGIN IMMEDIATE TRANSACTION') ? true : false;
else
return $this->link_id->exec('BEGIN TRANSACTION') ? true : false;
}


Expand Down

0 comments on commit 48c549c

Please sign in to comment.