apache / incubator-seata-go

Go Implementation For Seata
https://seata.apache.org/
Apache License 2.0
1.52k stars 269 forks source link

生成undo log sql失败 #593

Open slowmoon opened 1 year ago

slowmoon commented 1 year ago

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

{
            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}

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

Issues-translate-bot commented 1 year ago

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


Title: failed to generate undo log sql

iSuperCoder commented 1 year ago

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

Issues-translate-bot commented 1 year ago

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? 😄