Skip to content

Commit e794c6a

Browse files
committed
Merge branch 'mybatisGH-1158' of github.com:chb0github/mybatis-3 into mybatisGH-1158
* 'mybatisGH-1158' of github.com:chb0github/mybatis-3: MySQLSqlParser skip empty statements
2 parents f5a8764 + 262fa3a commit e794c6a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/main/java/org/apache/ibatis/parsing/sql/mysql/MySQLSqlParser.java

+9-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,14 @@ protected String readNextStatement() {
9393
sqlStatementBuilder = new MySQLSqlStatementBuilder(delimiter);
9494
}
9595
}
96-
return sqlStatementBuilder.isEmpty() ? null : sqlStatementBuilder.getSqlStatement();
96+
String retVal = null;
97+
if(!sqlStatementBuilder.isEmpty()){
98+
retVal = sqlStatementBuilder.getSqlStatement();
99+
if(retVal.trim().isEmpty()){
100+
retVal = readNextStatement();
101+
}
102+
}
103+
return retVal;
97104
}
98105

99106
private boolean isPreStatement(SqlStatementBuilder sqlStatementBuilder, String thisLine) {
@@ -119,4 +126,4 @@ private Delimiter extractNewDelimiterFromLine(String line) {
119126
return null;
120127
}
121128

122-
}
129+
}

0 commit comments

Comments
 (0)