incubator-seata-go icon indicating copy to clipboard operation
incubator-seata-go copied to clipboard

生成undo log sql失败

Open slowmoon opened this issue 2 years ago • 3 comments

当我再测试更新数据的时候

{
			sourceQuery:     "update t_user set name = ?, age = ? where id = ? or name = 'Jack' and age between ? and ?",
			sourceQueryArgs: []driver.Value{"Jack", 1, 100, 18, 28},
			expectQuery:     "SELECT SQL_NO_CACHE name,age,id FROM t_user WHERE id=? OR name=_UTF8MB4Jack AND age BETWEEN ? AND ? FOR UPDATE",
			expectQueryArgs: []driver.Value{100, 18, 28},
		},

使用上述测试生成前镜像sql,测试ok 当修改测试条件为where 条件加 '()' 后失败 例如:

{
			sourceQuery:     "update t_user set name = ?, age = ? where (id = ? or name = 'Jack') and age between ? and ?",
			sourceQueryArgs: []driver.Value{"Jack", 1, 100, 18, 28},
			expectQuery:     "SELECT SQL_NO_CACHE name,age,id FROM t_user WHERE (id=? OR name=_UTF8MB4Jack) AND age BETWEEN ? AND ? FOR UPDATE",
			expectQueryArgs: []driver.Value{100, 18, 28},
		},

测试结果为:

   


Not equal: 
            	            	expected: []driver.Value{100, 18, 28}
            	            	actual  : []driver.Value{18, 28}

如上,参数解析的不太正确

slowmoon avatar Jul 20 '23 10:07 slowmoon

RoBot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Title: failed to generate undo log sql

Issues-translate-bot avatar Jul 20 '23 10:07 Issues-translate-bot

@slowmoon 有没有兴趣debug找下原因并修复?😄

iSuperCoder avatar Jul 20 '23 10:07 iSuperCoder

RoBot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@slowmoon Are you interested in debugging to find the cause and fix it? 😄

Issues-translate-bot avatar Jul 20 '23 10:07 Issues-translate-bot