mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for issue #3986
This commit is contained in:
@@ -571,6 +571,15 @@ public class SQLUtils {
|
||||
return stmtList;
|
||||
}
|
||||
|
||||
public static List<SQLStatement> parseStatements(String sql, String dbType) {
|
||||
return parseStatements(sql, dbType, new SQLParserFeature[0]);
|
||||
}
|
||||
|
||||
|
||||
public static List<SQLStatement> parseStatements(String sql, DbType dbType) {
|
||||
return parseStatements(sql, dbType, new SQLParserFeature[0]);
|
||||
}
|
||||
|
||||
public static SQLStatement parseSingleStatement(String sql, DbType dbType, boolean keepComments) {
|
||||
SQLStatementParser parser = SQLParserUtils.createSQLStatementParser(sql, dbType, keepComments);
|
||||
List<SQLStatement> stmtList = parser.parseStatementList();
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.alibaba.druid.bvt.sql;
|
||||
|
||||
import com.alibaba.druid.sql.SQLUtils;
|
||||
import com.alibaba.druid.sql.ast.SQLStatement;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CompatibleTest extends TestCase {
|
||||
public void test_for_issue_3986() throws Exception {
|
||||
String sql = "select 1 from dual;";
|
||||
|
||||
List<SQLStatement> stmts = SQLUtils.parseStatements(sql, "mysql");
|
||||
assertEquals(1, stmts.size());
|
||||
assertEquals("select 1\n" +
|
||||
"from dual;", stmts.get(0).toLowerCaseString());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user