更新时间:2024-12-10 GMT+08:00
事务管理
TRANSACTION
DSC工具在迁移MySQL事务处理语句时会根据GaussDB(DWS)特性进行相应适配。
输入示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
##该声明仅适用于会话中执行的下一个单个事务 SET TRANSACTION ISOLATION LEVEL READ COMMITTED; SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; SET TRANSACTION READ ONLY; SET TRANSACTION READ WRITE; SET TRANSACTION ISOLATION LEVEL READ COMMITTED,READ ONLY; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE,READ WRITE; ##使用SESSION关键字,适用于当前会话中执行的所有后续事务 START TRANSACTION; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; commit ; |
输出示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
--该声明仅适用于会话中执行的下一个单个事务 SET LOCAL TRANSACTION ISOLATION LEVEL READ COMMITTED; SET LOCAL TRANSACTION ISOLATION LEVEL REPEATABLE READ; SET LOCAL TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SET LOCAL TRANSACTION ISOLATION LEVEL SERIALIZABLE; SET LOCAL TRANSACTION READ ONLY; SET LOCAL TRANSACTION READ WRITE; SET LOCAL TRANSACTION ISOLATION LEVEL READ COMMITTED READ ONLY; SET LOCAL TRANSACTION ISOLATION LEVEL SERIALIZABLE READ WRITE; --使用SESSION关键字,适用于当前会话中执行的所有后续事务 START TRANSACTION; SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL SERIALIZABLE; SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL SERIALIZABLE; COMMIT WORK; |
LOCK
DSC工具在迁移MySQL事务处理锁表语句时会根据GaussDB(DWS)特性进行相应适配。
输入示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
## A. START TRANSACTION; LOCK TABLES `mt`.`runoob_tbl` WRITE,`mt`.`runoob_tb2` READ; commit; ## B. START TRANSACTION; LOCK TABLES `mt`.`runoob_tbl` WRITE; commit; ## C. START TRANSACTION; LOCK TABLES `mt`.`runoob_tbl` READ,`mt`.`runoob_tbl` AS t1 READ; commit; |
输出示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
-- A. START TRANSACTION; LOCK TABLE "mt"."runoob_tbl" IN ACCESS EXCLUSIVE MODE; LOCK TABLE "mt"."runoob_tb2" IN ACCESS SHARE MODE; COMMIT WORK; -- B. START TRANSACTION; LOCK TABLE "mt"."runoob_tbl" IN ACCESS EXCLUSIVE MODE; COMMIT WORK; -- C. START TRANSACTION; LOCK TABLE "mt"."runoob_tbl" IN ACCESS SHARE MODE; COMMIT WORK; |
父主题: 事务管理和数据库管理