bug fixed for postgresql sql parser. support begin. for issue #2182

This commit is contained in:
wenshao
2018-02-11 10:24:56 +08:00
parent 859e1c5d7f
commit f046543d72
2 changed files with 36 additions and 14 deletions
@@ -16,13 +16,24 @@
package com.alibaba.druid.bvt.sql.postgresql;
import com.alibaba.druid.sql.PGTest;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.dialect.postgresql.ast.stmt.PGStartTransactionStatement;
import com.alibaba.druid.util.JdbcConstants;
import java.util.List;
public class PGBeginTest extends PGTest {
public void testBegin() throws Exception {
String sql = "start transaction;";
String expected = "START TRANSACTION";
String expected = "START TRANSACTION;";
testParseSql(sql, expected, expected, PGStartTransactionStatement.class);
}
public void testBegin_1() throws Exception {
String sql = "begin";
List<SQLStatement> stmtList = SQLUtils.parseStatements(sql, JdbcConstants.POSTGRESQL);
assertEquals(1, stmtList.size());
}
}