3.4.1 START TRANSACTION, COMMIT, and ROLLBACK Statements

3.4.1.1 Syntax

开启事务
START TRANSACTION

BEGIN

SET autocommit = {0 | 1}
提交事务
COMMIT
回滚事务
ROLLBACK

3.4.1.2 与MySQL语法区别

下文中红色表示不支持的语法或关键字

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}

3.4.1.3 限制

  • 2PC实现的分布式事务(非xa方式)可能会出现commit时部分提交的情况,如需保障最终一致性,需要开启XA

results matching ""

    No results matching ""