大网数据广告活动
PHP 语言与运行手册

SQLite3::busyTimeout · Sets the busy connection handler

· 52CE 我爱测

SQLite3::busyTimeout — Sets the busy connection handler

SQLite3::busyTimeout

(PHP 5 >= 5.3.3, PHP 7, PHP 8)

SQLite3::busyTimeout — Sets the busy connection handler

Description

public function SQLite3::busyTimeout(int $milliseconds): bool

Sets a busy handler that will sleep until the database is not locked or the timeout is reached.

The busy handler is built into SQLite, so no callback has to be provided. When a statement finds the database locked by another connection, SQLite keeps retrying for up to milliseconds. If the database is still locked after that, the statement fails with a database is locked error (SQLITE_BUSY).

How that failure shows up depends on SQLite3::enableExceptions(). With exceptions enabled, an SQLite3Exception is thrown. Otherwise an E_WARNING is raised and the method that ran the statement, such as SQLite3::exec() or SQLite3::query(), returns false.

By default no busy handler is set, so a statement fails right away if the database is locked.

Parameters

milliseconds

The maximum number of milliseconds to wait for a lock. Setting this value to a value less than or equal to zero, will turn off an already set timeout handler.

Return Values

Returns true if the busy timeout was set, or false on failure. The return value only tells whether the timeout was set. It does not mean that later statements will get the lock in time.

来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
PHP Documentation Group
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。