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

MySQL Parse提示异常 #2591

Closed
cnderrick opened this issue May 22, 2018 · 1 comment
Closed

MySQL Parse提示异常 #2591

cnderrick opened this issue May 22, 2018 · 1 comment
Labels
Milestone

Comments

@cnderrick
Copy link

在使用Druid的语法解析器时,跑以下代码时:

`
@test

public void getParseModifySqlTask() {
        try {
            MySqlStatementParser parser = new MySqlStatementParser("ALTER TABLE `result` ADD INDEX `index_code` (`code`) USING BTREE;");
            parser.parseStatementList();
        } catch (ParserException e) {
            e.printStackTrace();
        }
}

`

报出如下错误信息:

`

com.alibaba.druid.sql.parser.ParserException: syntax error, error in :'SING BTREE;', expect IDENTIFIER, actual IDENTIFIER pos 58, line 1, column 59, token IDENTIFIER BTREE
at com.alibaba.druid.sql.parser.SQLParser.printError(SQLParser.java:284)
at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:423)
at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:72)
at com.test.SqlUtilTest.getParseModifySqlTask(SqlUtilTest.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
`
使用了1.1.7 和 1.1.9 都跑了一遍,问题依然存在。分析应该是在SQL解析时出现问题导致的。 删除后面的 USING BTREE,再跑一遍后错误不出现。

该条SQL是可以在MySQL上执行成功的。

@wenshao wenshao added the Bug label May 25, 2018
@wenshao wenshao added this to the 1.1.10 milestone May 25, 2018
@wenshao
Copy link
Member

wenshao commented May 27, 2018

https://github.com/alibaba/druid/releases/tag/1.1.10
问题修复,请用新版本

@wenshao wenshao closed this as completed May 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants