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

表结构列名本身包含了转移字符`,在AT模式构建sql会发生歧义

Open luometeor opened this issue 2 years ago • 1 comments

  • [ ] I have searched the issues of this repository and believe that this is not a duplicate.

Ⅰ. Issue Description

在Seata的AT模式中,通过SQLInsertRecognizer#getInsertColumns得到用户填写的sql,如果用户填写的sql的列中有转移字符,那么有两种情况,第一是表列名本身没有该转移字符,第二是表列名本身包含了转移字符`,在MySQLInsertOrUpdateExecutor构建sql中,给字段加上了转移字符会发生下面的报错

Ⅱ. Describe what happened

If there is an exception, please attach the exception trace:

Just paste your stack trace here!

image

Ⅲ. Describe what you expected to happen

如果不处理表结构有的转移字符,上述的歧义忽视,那么可以简单的在MySQLInsertOrUpdateExecutor构建sql时,用ColumnUtils将转移字符去除

Ⅳ. How to reproduce it (as minimally and precisely as possible)

  1. xxx
  2. xxx
  3. xxx

Ⅴ. Anything else we need to know?

Ⅵ. Environment:

  • JDK version : 1.8
  • Seata version: 1.5.0
  • OS : windows
  • Others:

luometeor avatar Jul 03 '22 13:07 luometeor

@luometeor Looking forward to submit a PR to fix this issue.

slievrly avatar Jul 06 '22 03:07 slievrly