mysql_commit() COMMIT ROLLBACK 提交 回滚 连接释放
MySQL :: MySQL 8.0 Reference Manual :: 28.7.7.6 mysql_commit() https://dev.mysql.com/doc/refman/8.0/en/mysql-commit.html
28.7.7.6 mysql_commit()
bool mysql_commit(MYSQL *mysql)
Description
Commits the current transaction.
The action of this function is subject to the value of the completion_type
system variable. In particular, if the value of completion_type
isRELEASE
(or 2), the server performs a release after terminating a transaction and closes the client connection. Call mysql_close()
from the client program to close the connection from the client side.
Return Values
Zero for success. Nonzero if an error occurred.
Errors
None.
MySQL :: MySQL 8.0 Reference Manual :: 5.1.8 Server System Variables https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_completion_type
Property | Value |
---|---|
Command-Line Format | --completion-type=# |
System Variable | completion_type |
Scope | Global, Session |
Dynamic | Yes |
SET_VAR Hint Applies |
No |
Type | Enumeration |
Default Value | NO_CHAIN |
Valid Values |
|
The transaction completion type. This variable can take the values shown in the following table. The variable can be assigned using either the name values or corresponding integer values.
Value | Description |
---|---|
NO_CHAIN (or 0) |
COMMIT and ROLLBACK are unaffected. This is the default value. |
CHAIN (or 1) |
COMMIT and ROLLBACK are equivalent to COMMIT AND CHAIN and ROLLBACK AND CHAIN , respectively. (A new transaction starts immediately with the same isolation level as the just-terminated transaction.) |
RELEASE (or 2) |
COMMIT and ROLLBACK are equivalent to COMMIT RELEASE and ROLLBACK RELEASE , respectively. (The server disconnects after terminating the transaction.) |
completion_type
affects transactions that begin with START TRANSACTION
or BEGIN
and end with COMMIT
or ROLLBACK
. It does not apply to implicit commits resulting from execution of the statements listed in Section 13.3.3, “Statements That Cause an Implicit Commit”. It also does not apply for XA COMMIT
, XA ROLLBACK
, or when autocommit=1
.
理解commit
13.3.1 START TRANSACTION, COMMIT, and ROLLBACK Syntax
START TRANSACTION
[transaction_characteristic [, transaction_characteristic] ...]
transaction_characteristic: {
WITH CONSISTENT SNAPSHOT
| READ WRITE
| READ ONLY
}
BEGIN [WORK]
COMMIT [WORK] [AND [NO] CHAIN] [[NO] RELEASE]
ROLLBACK [WORK] [AND [NO] CHAIN] [[NO] RELEASE]
SET autocommit = {0 | 1}
These statements provide control over use of transactions:
START TRANSACTION
orBEGIN
start a new transaction.COMMIT
commits the current transaction, making its changes permanent.ROLLBACK
rolls back the current transaction, canceling its changes.SET autocommit
disables or enables the default autocommit mode for the current session.
MySQL :: MySQL 8.0 Reference Manual :: 13.3.1 START TRANSACTION, COMMIT, and ROLLBACK Syntax https://dev.mysql.com/doc/refman/8.0/en/commit.html
【如果在select读的情况下,假如认为对数据库无影响无烙印的操作,那么commit提交,就没有必要】
【连接的关闭:分为客户端、mysql服务端,都可以发起关闭】
最新文章
- java8 lamda快速入门
- 基于CkEditor实现.net在线开发之路(8)Vs开发怎么配置
- [Linux] - Docker 常用命令
- Linux System and Performance Monitoring
- 17. javacript高级程序设计-错误处理与调试
- Android SQLite数据储存方式
- Codeforces Educational Codeforces Round 15 A. Maximum Increase
- 全面解析java注解
- [TYVJ] P1049 最长不下降子序列
- oracle rman异机恢复
- Node.js 开发指南笔记
- 【转载】FaceBook - How to add a Privacy Policy to your Apps?
- Ioc容器依赖注入-Spring 源码系列(2)
- 数据库的优化(表优化和sql语句优化)
- Android中Socket通信之TCP与UDP传输原理
- kafka 三个配置文件
- JDK、JRE
- iOS 开发 nonatomic 和 atomic
- zuul ci
- 走进JDK(五)------AbstractList
热门文章
- bedtools 的安装与使用
- NSArray打印汉字的方法
- Unity延迟和重复调用方法
- 51地图标注接口(EZMarker API)
- mysqldump如何针对某些数据库进行备份?针对某个数据库进行备份?
- 理解ros话题--6
- mongodb启动时报错ERROR: child process failed, exited with error number 1
- Java精选笔记_自定义标签
- java.lang.OutOfMemoryError 错误分类
- 内存监测工具 DDMS -->; Heap