Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复mysql语句解析异常问题,mysql实际执行正常 #6041

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

AdolphLv
Copy link
Contributor

No description provided.

@wenshao
Copy link
Member

wenshao commented Jul 15, 2024

请补充testcase

@AdolphLv
Copy link
Contributor Author

AdolphLv commented Aug 1, 2024

请补充testcase

代码示例:

public static void main(String[] args) { String sql = "((select * from b where 1=1) limit 0,123)"; SQLStatement sqlStatement = SQLUtils.parseSingleMysqlStatement(sql); System.out.println(SQLUtils.toMySqlString(sqlStatement)); }

执行报错内容:

Exception in thread "main" com.alibaba.druid.sql.parser.ParserException: syntax error, error in :'1=1) limit 0,123)', expect ), actual LIMIT, pos 34, line 1, column 30, token LIMIT at com.alibaba.druid.sql.parser.SQLParser.printError(SQLParser.java:870) at com.alibaba.druid.sql.parser.SQLParser.accept(SQLParser.java:878) at com.alibaba.druid.sql.dialect.mysql.parser.MySqlSelectParser.query(MySqlSelectParser.java:106) at com.alibaba.druid.sql.parser.SQLSelectParser.select(SQLSelectParser.java:74) at com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser.parseSelect(MySqlStatementParser.java:120) at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:625) at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:110) at com.alibaba.druid.sql.SQLUtils.parseSingleStatement(SQLUtils.java:657) at com.alibaba.druid.sql.SQLUtils.parseSingleMysqlStatement(SQLUtils.java:688) at com.alibaba.druid.sql.SQLUtils.main(SQLUtils.java:2277)

SQL 语句在mysql中执行能正常出结果

@wenshao
Copy link
Member

wenshao commented Aug 5, 2024

请在代码中补充testcase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants