提交 588e4e05 authored 作者: noelgrandin's avatar noelgrandin

Issue 524: RunScript.execute does not close its Statement, patch from Gaul.

上级 6089c852
...@@ -31,6 +31,7 @@ Change Log ...@@ -31,6 +31,7 @@ Change Log
</li><li>Support 123L syntax as in Java; example: SELECT (2000000000L*2). </li><li>Support 123L syntax as in Java; example: SELECT (2000000000L*2).
</li><li>Issue 520: Add support for sequence max value, min value and cycle, patch by Daniel Gredler. </li><li>Issue 520: Add support for sequence max value, min value and cycle, patch by Daniel Gredler.
</li><li>Issue 521: ScriptReader should implement Closeable </li><li>Issue 521: ScriptReader should implement Closeable
</li><li>Issue 524: RunScript.execute does not close its Statement, patch from Gaul.
</li></ul> </li></ul>
<h2>Version 1.3.174 (2013-10-19)</h2> <h2>Version 1.3.174 (2013-10-19)</h2>
......
...@@ -157,6 +157,7 @@ public class RunScript extends Tool { ...@@ -157,6 +157,7 @@ public class RunScript extends Tool {
public static ResultSet execute(Connection conn, Reader reader) throws SQLException { public static ResultSet execute(Connection conn, Reader reader) throws SQLException {
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
ResultSet rs = null; ResultSet rs = null;
try {
ScriptReader r = new ScriptReader(reader); ScriptReader r = new ScriptReader(reader);
while (true) { while (true) {
String sql = r.readStatement(); String sql = r.readStatement();
...@@ -175,6 +176,9 @@ public class RunScript extends Tool { ...@@ -175,6 +176,9 @@ public class RunScript extends Tool {
rs = stat.getResultSet(); rs = stat.getResultSet();
} }
} }
} finally {
JdbcUtils.closeSilently(stat);
}
return rs; return rs;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论