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

Fix thrown exceptions from JdbcPreparedStatement.getGeneratedKeys()

上级 bced9290
......@@ -21,6 +21,8 @@ Change Log
<h2>Next Version (unreleased)</h2>
<ul>
<li>Issue #1604: TestCrashAPI: PreparedStatement.getGeneratedKeys() is already closed
</li>
<li>PR #1664: Allow any expressions in window frames
</li>
<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
@Override
public ResultSet getGeneratedKeys() throws SQLException {
if (batchIdentities != null) {
int id = getNextId(TraceObject.RESULT_SET);
if (isDebugEnabled()) {
debugCodeAssign("ResultSet", TraceObject.RESULT_SET, id, "getGeneratedKeys()");
try {
int id = getNextId(TraceObject.RESULT_SET);
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();
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论