File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
main/jjtree/net/sf/jsqlparser/parser
test/java/net/sf/jsqlparser/statement Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -312,10 +312,10 @@ Statements Statements() #Statements :
312312 List<Statement> list = new ArrayList<Statement>();
313313 Statement stm; }
314314{
315+ (";")*
315316 stm = SingleStatement() { list.add(stm); }
316- (LOOKAHEAD(2) ";" stm = SingleStatement() { list.add(stm); } )*
317+ ( ( ";") [ stm = SingleStatement() { list.add(stm); } ] )*
317318
318- [";"]
319319 <EOF>
320320
321321 {
Original file line number Diff line number Diff line change @@ -49,4 +49,15 @@ public void testStatements() throws JSQLParserException {
4949 assertTrue (parseStatements .getStatements ().get (1 ) instanceof Select );
5050 }
5151
52+ @ Test
53+ public void testStatementsProblem () throws JSQLParserException {
54+ String sqls = ";;select * from mytable;;select * from mytable2;;;" ;
55+ Statements parseStatements = CCJSqlParserUtil .parseStatements (sqls );
56+
57+ assertEquals ("SELECT * FROM mytable;\n SELECT * FROM mytable2;\n " , parseStatements .toString ());
58+
59+ assertTrue (parseStatements .getStatements ().get (0 ) instanceof Select );
60+ assertTrue (parseStatements .getStatements ().get (1 ) instanceof Select );
61+ }
62+
5263}
You can’t perform that action at this time.
0 commit comments