[#4277] Fixed ConnectionProvider regression on exceptions
This commit is contained in:
parent
e8f63e37f4
commit
0fb8c29b1a
@ -101,7 +101,7 @@ class DefaultExecuteContext implements ExecuteContext {
|
||||
private final int[] batchRows;
|
||||
|
||||
// Transient attributes (created afresh per execution)
|
||||
private transient ConnectionProvider connectionProvider;
|
||||
transient ConnectionProvider connectionProvider;
|
||||
private transient Connection connection;
|
||||
private transient SettingsEnabledConnection wrappedConnection;
|
||||
private transient PreparedStatement statement;
|
||||
@ -763,8 +763,8 @@ class DefaultExecuteContext implements ExecuteContext {
|
||||
public final Connection acquire() {
|
||||
|
||||
// [#4277] Connections are acquired lazily in parent ExecuteContext. A child ExecuteContext
|
||||
// may well need a Connection earlier than the parent, in case of which acquisition is
|
||||
// forced in the parent as well.
|
||||
// may well need a Connection earlier than the parent, in case of which acquisition is
|
||||
// forced in the parent as well.
|
||||
if (connection == null)
|
||||
DefaultExecuteContext.this.connection();
|
||||
|
||||
|
||||
@ -2332,9 +2332,8 @@ final class Tools {
|
||||
ctx.resultSet(null);
|
||||
|
||||
PreparedStatement statement = ctx.statement();
|
||||
if (statement != null) {
|
||||
if (statement != null)
|
||||
consumeWarnings(ctx, listener);
|
||||
}
|
||||
|
||||
// [#385] Close statements only if not requested to keep open
|
||||
if (!keepStatement) {
|
||||
@ -2348,9 +2347,11 @@ final class Tools {
|
||||
else {
|
||||
Connection connection = localConnection();
|
||||
|
||||
if (connection != null) {
|
||||
ctx.configuration().connectionProvider().release(connection);
|
||||
}
|
||||
// [#4277] We must release the connection on the ExecuteContext's
|
||||
// ConnectionProvider, as the ctx.configuration().connectionProvider()
|
||||
// is replaced by a ExecuteContextConnectionProvider instance.
|
||||
if (connection != null && ((DefaultExecuteContext) ctx).connectionProvider != null)
|
||||
((DefaultExecuteContext) ctx).connectionProvider.release(connection);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user