mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
revert #3484
This commit is contained in:
@@ -366,6 +366,8 @@ public class SQLExprParser extends SQLParser {
|
||||
((SQLBinaryOpExpr) sqlExpr).setBracket(true);
|
||||
}
|
||||
|
||||
accept(Token.RPAREN);
|
||||
|
||||
if (lexer.token == Token.UNION && sqlExpr instanceof SQLQueryExpr) {
|
||||
SQLQueryExpr queryExpr = (SQLQueryExpr) sqlExpr;
|
||||
|
||||
@@ -377,7 +379,7 @@ public class SQLExprParser extends SQLParser {
|
||||
//select * from test_a where id=(select id from test_b where id = 1) union all select * from test_c .....
|
||||
//会解析为 select * from select * from test_a where id=(select id from test_b where id = 1 union all select * from test_c .....
|
||||
//所以需要将accept(Token.RPAREN) 移动到 处理 Union all 以及 子查询之后
|
||||
accept(Token.RPAREN);
|
||||
|
||||
|
||||
break;
|
||||
case INSERT:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.alibaba.druid.bvt.sql.oracle;
|
||||
|
||||
import com.alibaba.druid.sql.SQLUtils;
|
||||
import com.alibaba.druid.sql.parser.ParserException;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
@@ -16,7 +17,12 @@ public class AntlrExamplesTest extends TestCase {
|
||||
for (File file : dir.listFiles()) {
|
||||
System.out.println(file);
|
||||
String sql = FileUtils.readFileToString(file);
|
||||
SQLUtils.parseStatements(sql, JdbcConstants.ORACLE);
|
||||
try {
|
||||
SQLUtils.parseStatements(sql, JdbcConstants.ORACLE);
|
||||
} catch (ParserException ex) {
|
||||
System.out.println(sql);
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user