bug fixed for issue #1576 #1577

This commit is contained in:
wenshao
2017-02-03 23:10:21 +08:00
parent 1a6ad677d2
commit 16ea7700ed
2 changed files with 32 additions and 4 deletions
@@ -15,6 +15,7 @@
*/
package com.alibaba.druid.sql.parser;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
@@ -2037,10 +2038,11 @@ public class SQLStatementParser extends SQLParser {
*/
public SQLStatement parseStatement( final boolean tryBest) {
List<SQLStatement> list = new ArrayList<SQLStatement>();
if(tryBest){
this.parseStatementList(list, 1);
}else{
parseStatementList(list);
this.parseStatementList(list, 1);
if (tryBest) {
if (lexer.token() != Token.EOF) {
throw new ParserException("sql syntax error, no terminated. " + lexer.token());
}
}
return list.get(0);
}