提交 7c87be33 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Fix thrown exceptions from JdbcPreparedStatement.getGeneratedKeys()

上级 bced9290
...@@ -21,6 +21,8 @@ Change Log ...@@ -21,6 +21,8 @@ Change Log
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul> <ul>
<li>Issue #1604: TestCrashAPI: PreparedStatement.getGeneratedKeys() is already closed
</li>
<li>PR #1664: Allow any expressions in window frames <li>PR #1664: Allow any expressions in window frames
</li> </li>
<li>Issue #1576: H2 Console should not display precision and scale for data types that don't have them <li>Issue #1576: H2 Console should not display precision and scale for data types that don't have them
......
...@@ -1309,12 +1309,17 @@ public class JdbcPreparedStatement extends JdbcStatement implements ...@@ -1309,12 +1309,17 @@ public class JdbcPreparedStatement extends JdbcStatement implements
@Override @Override
public ResultSet getGeneratedKeys() throws SQLException { public ResultSet getGeneratedKeys() throws SQLException {
if (batchIdentities != null) { if (batchIdentities != null) {
int id = getNextId(TraceObject.RESULT_SET); try {
if (isDebugEnabled()) { int id = getNextId(TraceObject.RESULT_SET);
debugCodeAssign("ResultSet", TraceObject.RESULT_SET, id, "getGeneratedKeys()"); if (isDebugEnabled()) {
debugCodeAssign("ResultSet", TraceObject.RESULT_SET, id, "getGeneratedKeys()");
}
checkClosed();
generatedKeys = new JdbcResultSet(conn, this, null, batchIdentities.getResult(), id, false, true,
false);
} catch (Exception e) {
throw logAndConvert(e);
} }
checkClosed();
generatedKeys = new JdbcResultSet(conn, this, null, batchIdentities.getResult(), id, false, true, false);
} }
return super.getGeneratedKeys(); return super.getGeneratedKeys();
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论