Skip to content

为什么有些语句审核后不生成回滚语句 #391

Answered by sjjian
sjjian asked this question in Q&A
Discussion options

You must be logged in to vote

生成回滚语句的条件:

DDL

生成逻辑上的反向语句;目前支持的语句类型包括:

  • alter table,
  • create table,
  • drop table,
  • add index,
  • drop index;

alter table 支持如下操作:

  • rename table
  • add column
  • drop column
  • change column
  • alter column
  • add index
  • drop index
  • add primary key
  • drop primary key
  • add foreign key
  • drop foreign key

DML

生成回滚语句原理是解析 DML 语句生成对应的select 语句,根据 select 的结果来生成回滚语句,这种回滚方式可能会存在性能消耗,建议不开启。

开启条件

  1. 必须开启规则 "在 DML 语句中预计影响行数超过指定值则不回滚";

限制

  1. 操作的表必须要有主键;
  2. 仅支持较为简单的DML SQL;
  3. 暂不支持 multi-table syntax;
  4. 暂不支持 where 条件带 select 的语句;
  5. 插入的表必须有primary key, 且 insert 时 指定了 primary key 的值;
  6. 暂不支持 insert ... select syntax;
  7. 暂不支持包含变量的语句;(例: UPDATE users SET business = 2 WHERE id = @aeskey;)

Replies: 1 comment

Comment options

sjjian
Mar 14, 2022
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by sjjian
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant