提交 fafdb478 authored 作者: Thomas Mueller's avatar Thomas Mueller

Issue 347: the RunScript and Shell tools now ignore empty statements.

上级 4312fc58
......@@ -161,6 +161,9 @@ public class RunScript extends Tool {
if (sql == null) {
break;
}
if (sql.trim().length() == 0) {
continue;
}
boolean resultSet = stat.execute(sql);
if (resultSet) {
if (rs != null) {
......@@ -196,6 +199,9 @@ public class RunScript extends Tool {
break;
}
String trim = sql.trim();
if (trim.length() == 0) {
continue;
}
if (trim.startsWith("@") && StringUtils.toUpperEnglish(trim).startsWith("@INCLUDE")) {
sql = trim;
sql = sql.substring("@INCLUDE".length()).trim();
......@@ -205,7 +211,6 @@ public class RunScript extends Tool {
process(conn, sql, continueOnError, charsetName);
} else {
try {
if (trim.length() > 0) {
if (showResults && !trim.startsWith("-->")) {
out.print(sql + ";");
}
......@@ -247,7 +252,6 @@ public class RunScript extends Tool {
} else {
stat.execute(sql);
}
}
} catch (Exception e) {
if (continueOnError) {
e.printStackTrace(out);
......
......@@ -419,6 +419,9 @@ public class Shell extends Tool implements Runnable {
}
private void execute(String sql) {
if (sql.trim().length() == 0) {
return;
}
long time = System.currentTimeMillis();
try {
ResultSet rs = null;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论