PHP 5.4.45 Released

SQLite3::busyTimeout

(PHP 5 >= 5.3.3)

SQLite3::busyTimeoutDéfinit le gestionnaire d'attente de la connexion

Description

public bool SQLite3::busyTimeout ( int $msecs )

Définit le gestionnaire d'attente qui patientera tant que la base de données n'est pas verrouillée ou que le délai d'attente ne soit atteint.

Liste de paramètres

msecs

Les millisecondes à attendre. Le fait de définir cette valeur à une valeur inférieure ou égale à zéro désactivera un gestionnaire d'attente précédemment défini.

Valeurs de retour

Retourne TRUE en cas de succès, FALSE si une erreur survient.

add a note add a note

User Contributed Notes 2 notes

up
6
ppryor63 at gmail dot com
1 year 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.
up
0
dkarnout at gmail dot com
22 days 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.
To Top