mysqli::commit

mysqli_commit

(PHP 5, PHP 7, PHP 8)

mysqli::commit -- mysqli_commit提交当前事务

说明

面向对象风格

public mysqli::commit(int $flags = 0, ?string $name = null): bool

过程化风格

mysqli_commit(mysqli $mysql, int $flags = 0, ?string $name = null): bool

提交当前数据库连接的事务。

参数

mysql

仅以过程化样式:由mysqli_connect()mysqli_init() 返回的 mysqli 对象。

flags

MYSQLI_TRANS_COR_* 常量的位掩码。

name

如果提供,则执行 COMMIT/*name*/

返回值

成功时返回 true, 或者在失败时返回 false

错误/异常

If mysqli error reporting is enabled (MYSQLI_REPORT_ERROR) and the requested operation fails, a warning is generated. If, in addition, the mode is set to MYSQLI_REPORT_STRICT, a mysqli_sql_exception is thrown instead.

更新日志

版本 说明
8.0.0 name 现在允许为 null。

范例

参阅 mysqli::begin_transaction() 示例。

注释

注意:

此方法在不支持事务的表类型中不生效,如 MyISAM 或 ISAM。

参见

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top