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服务端,都可以发起关闭】
mysql_commit() COMMIT ROLLBACK 提交 回滚 连接释放的更多相关文章
- SVN 提交回滚
取消对代码的修改分为两种情况: 第一种情况:改动没有被提交(commit). 这种情况下,使用svn revert就能取消之前的修改. svn revert用法如下: # svn revert [ ...
- sourceTree"重置提交"和"提交回滚"的区别
相信用过sourceTree的伙伴们都认识这两,但是不一定用过这两个功能,甚至是不能很好的把握它两的区别,根据自己最近亲身测试,总算是能小小的总结一下了 首先这儿假如,历史版本已经出现了1.2.3.4 ...
- 分布式系统的Raft算法——在失联阶段这个老Leader的任何更新都不能算commit,都回滚,接受新的Leader的新的更新 意味着还是可能丢数据!!!
过去, Paxos一直是分布式协议的标准,但是Paxos难于理解,更难以实现,Google的分布式锁系统Chubby作为Paxos实现曾经遭遇到很多坑. 来自Stanford的新的分布式协议研究称为R ...
- Jfinal中手动提交/回滚 事物
在Jfinal中有个Tx类为事物声明类 在方法或controller上面加@Before({Tx.class})即可,可是这样并不能满足有的业务场景 下面是今天写的手动提交的事物处理方法,希望对大家有 ...
- C#代码启用事务锁Transaction进行一系列提交回滚操作
一.前言 因为很多人一般进行一系列相关数据库操作都是在存储过程里面,而且在存储过程用锁的写法也是很简单的,在这篇文章主要介绍一下C#后台代码用锁进行一系列事务操作,我建立一个简单的winform程序, ...
- JDBC事务提交/回滚实例
以下是使用事务教程中描述的提交和回滚的代码示例. 此示例代码是基于前面章节中完成的环境和数据库设置编写的. 复制并将以下示例代码保存到:CommitAndRollback.java 中,编译并运行如下 ...
- cascading rollback 级联回滚
Computer Science An Overview _J. Glenn Brookshear _11th Edition To emphasize the delicate nature of ...
- 对mysql事务提交、回滚的错误理解
一.起因 begin或者START TRANSACTION开始一个事务 rollback事务回滚 commit 事务确认 人们对事务的解释如下:事务由作为一个单独单元的一个或多个SQL语句组成,如果其 ...
- spring5 源码深度解析----- 事务的回滚和提交(100%理解事务)
上一篇文章讲解了获取事务,并且通过获取的connection设置只读.隔离级别等,这篇文章讲解剩下的事务的回滚和提交 回滚处理 之前已经完成了目标方法运行前的事务准备工作,而这些准备工作最大的目的无非 ...
随机推荐
- DTD -- XML验证
DTD(文档类型定义)的作用是定义 XML 文档的合法构建模块. DTD 可被成行地声明于 XML 文档中,也可作为一个外部引用. DTD简介 内部的 DOCTYPE 声明 假如 DTD 被包含在您的 ...
- PHPOffice下PHPWord生成Word2007(docx)使用方法
要正常使用,下载依赖包: PhpOffice/Common:https://github.com/PHPOffice/Common Zend/Escaper:https://github.com/ze ...
- mac下zephir第一步,安装+hello zephir!
第一步 安装autoconf re2c automake libtool等依赖,如果没有安装git的记得先安装git brew install autoconf brew install automa ...
- JavaSE集合(八)之Map
前面给大家介绍了集合家族中的Collection家族,这一篇给大家分享的是集合中的另一个家族就是Map家族.以前的时候学习Map的时候没有很认真的去学习,我觉得很多东西还是不是很清楚. 这次我将总结的 ...
- Linux 查找具体的文件名称
在大概知道文了件地址的情况下, 比如root@masterback:/# cd /usr/lib/jvm/ root@masterback:/usr/lib/jvm# ls 出来具体的文件名称
- fstrict-aliasing
承如“optimization blocks”文中所述,由于相同的指针可能指向相关的内存区,因此编译器将不做过分的优化…… 特意搜了下编译器在不同的优化等级下都有哪些默认优化,因此有了此记录(比较长, ...
- MathType编辑双向斜箭头的教程
箭头是一个很常见的符号,不只是在数学中,在各个方面出现的频率都很高,因此在数学公式中出现时,用MathType公式编辑器编辑公式时也要尽量地能够编辑出这些符号.箭头符号在MathType中有很多,使用 ...
- C#获取IP信息
/// <summary> /// 通过IP得到IP所在地省市(Porschev) /// </summary> /// <param name="ip&quo ...
- 使用MFC WinInet进行FTP中文件的简单上传和下载功能
建立基于对话框的MFC应用程序CMfcFtpWinInetDlg: 1.首先Dlg类中包含头文件 #include "afxinet.h" 2.添加成员变量: C++ Code ...
- html 页面模块的常用命名
头:header 内容:content/container 尾:footer 导航:nav 侧栏:sidebar 栏目: ...