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 :
312
312
List<Statement> list = new ArrayList<Statement>();
313
313
Statement stm; }
314
314
{
315
+ (";")*
315
316
stm = SingleStatement() { list.add(stm); }
316
- (LOOKAHEAD(2) ";" stm = SingleStatement() { list.add(stm); } )*
317
+ ( ( ";") [ stm = SingleStatement() { list.add(stm); } ] )*
317
318
318
- [";"]
319
319
<EOF>
320
320
321
321
{
Original file line number Diff line number Diff line change @@ -49,4 +49,15 @@ public void testStatements() throws JSQLParserException {
49
49
assertTrue (parseStatements .getStatements ().get (1 ) instanceof Select );
50
50
}
51
51
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
+
52
63
}
You can’t perform that action at this time.
0 commit comments