Skip to content

Commit

Permalink
exchange rule name && update unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
hasa1K committed Sep 27, 2023
1 parent 8f0d842 commit 2a01904
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions sqle/driver/mysql/audit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6710,7 +6710,7 @@ func TestMustUseLeftMostPrefix(t *testing.T) {
{
Name: "select-with-equal",
Sql: `select * from exist_tb_9 where v4 = 1`,
TriggerRule: false,
TriggerRule: true,
},
{
Name: "select-without-equal",
Expand Down Expand Up @@ -6776,7 +6776,7 @@ func TestMustUseLeftMostPrefix(t *testing.T) {
{
Name: "update-with-equal",
Sql: `update exist_tb_9 set v4 = 1 where v4 = 1`,
TriggerRule: false,
TriggerRule: true,
},
{
Name: "update-without-equal",
Expand Down Expand Up @@ -6822,7 +6822,7 @@ func TestMustUseLeftMostPrefix(t *testing.T) {
{
Name: "delete-with-equal",
Sql: `delete from exist_tb_9 where v4 = 1`,
TriggerRule: false,
TriggerRule: true,
},
{
Name: "delete-without-equal",
Expand All @@ -6842,7 +6842,7 @@ func TestMustUseLeftMostPrefix(t *testing.T) {
{
Name: "delete-without-equal",
Sql: `delete from exist_tb_9 where v4 > 1`,
TriggerRule: false,
TriggerRule: true,
},
{
Name: "delete-without-equal",
Expand Down
4 changes: 2 additions & 2 deletions sqle/driver/mysql/rule/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -2257,7 +2257,7 @@ var RuleHandlers = []RuleHandler{
},
{
Rule: driverV2.Rule{
Name: DMLMustMatchLeftMostPrefix,
Name: DMLMustUseLeftMostPrefix,
Desc: "使用联合索引时,必须使用联合索引的首字段",
Annotation: "使用联合索引时,不包含首字段会导致联合索引失效",
Level: driverV2.RuleLevelError,
Expand All @@ -2269,7 +2269,7 @@ var RuleHandlers = []RuleHandler{
},
{
Rule: driverV2.Rule{
Name: DMLMustUseLeftMostPrefix,
Name: DMLMustMatchLeftMostPrefix,
Desc: "禁止对联合索引左侧字段进行IN 、OR等非等值查询",
Annotation: "对联合索引左侧字段进行IN 、OR等非等值查询会导致联合索引失效",
Level: driverV2.RuleLevelError,
Expand Down
2 changes: 1 addition & 1 deletion sqle/driver/mysql/session/mock_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ v2 varchar(255) character SET utf8mb4,
v3 int,
v4 int,
PRIMARY KEY (id) USING BTREE,
KEY idx_1 (v1,v2,v3),
KEY idx_1 (v1,v2,v3, v4),
UNIQUE KEY uniq_1 (v2,v3),
KEY idx_100 (v3)
)ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT="unit test";
Expand Down

0 comments on commit 2a01904

Please sign in to comment.