File tree Expand file tree Collapse file tree
user_guide_src/source/database Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ class Database extends Config
6767 'failover ' => [],
6868 'port ' => 3306 ,
6969 'foreignKeys ' => true ,
70+ 'busyTimeout ' => 1000 ,
7071 ];
7172
7273 public function __construct ()
Original file line number Diff line number Diff line change @@ -45,13 +45,26 @@ class Connection extends BaseConnection
4545 */
4646 protected $ foreignKeys = false ;
4747
48+ /**
49+ * The milliseconds to sleep
50+ *
51+ * @var int|null milliseconds
52+ *
53+ * @see https://www.php.net/manual/en/sqlite3.busytimeout
54+ */
55+ protected $ busyTimeout ;
56+
4857 public function initialize ()
4958 {
5059 parent ::initialize ();
5160
5261 if ($ this ->foreignKeys ) {
5362 $ this ->enableForeignKeyChecks ();
5463 }
64+
65+ if (is_int ($ this ->busyTimeout )) {
66+ $ this ->simpleQuery ('PRAGMA busy_timeout= ' . $ this ->busyTimeout );
67+ }
5568 }
5669
5770 /**
Original file line number Diff line number Diff line change @@ -150,6 +150,7 @@ Explanation of Values:
150150 .. important:: SQLite3 Foreign Key constraint is disabled by default.
151151 See `SQLite documentation <https://www.sqlite.org/pragma.html#pragma_foreign_keys >`_.
152152 To enforce Foreign Key constraint, set this config item to true.
153+ **busyTimeout ** milliseconds (int) - Sleeps for a specified amount of time when a table is locked (``SQLite3 `` only).
153154=============== ===========================================================================================================
154155
155156.. note :: Depending on what database platform you are using (MySQL, PostgreSQL,
You can’t perform that action at this time.
0 commit comments