SQLite3::busyTimeout
(PHP 5 >= 5.3.3, PHP 7, PHP 8)
SQLite3::busyTimeout — 接続がビジー状態のときのハンドラを設定する
説明
ビジーハンドラを設定します。 これは、データベースのロックが解除されるかあるいはタイムアウトに達するまでスリープさせます。
パラメータ
milliseconds
-
スリープさせる時間 (ミリ秒)。この値をゼロ以下にすると、 すでに設定されているタイムアウトハンドラを無効にします。
+add a note
User Contributed Notes 3 notes
ppryor63 at gmail dot com ¶
10 years ago
The busyTimeout() method and related API sqlite3_busy_timeout() is a connection level attribute and affects whole connection and should be set once after opening connection. Do not set to zero or you will encounter "Database is busy" error message when calling query, querySingle, prepare, or execute methods. Also ensure that sqlite3 library is compiled with HAVE_USLEEP defined, otherwise busyTimeout() can only time out in seconds. It is very highly recommended to call busyTimeout() with non-zero timeout for reliability in concurrent environment.
anthony at domps dot fr ¶
3 years ago
It's possible to use PRAGMA to set busyTimeout (milliseconds) :
<?php
$db = new SQLite3('my.db');
$db->exec("PRAGMA busy_timeout=5000");
?>
dkarnout at gmail dot com ¶
9 years ago
For SQLite2 (http://php.net/manual/en/function.sqlite-busy-timeout.php), PHP sets the default busy timeout to be 60 seconds when the database is opened.
However, this does not happen for v3 and it has to be done manually.
My personal experience is that the default value of SQLite3, which is 0, is not enough when you have to do consecutive read/write commits and the file has not been accessed for long time.
↑ and ↓ to navigate •
Enter to select •
Esc to close
Press Enter without
selection to search using Google