Skip to content

Commit

Permalink
Merge pull request #13 from ethan-philpott/master
Browse files Browse the repository at this point in the history
Fixed closed statement running on non-open connection
  • Loading branch information
kevin-so-querypie authored Feb 21, 2023
2 parents 6d10214 + 473f990 commit ed82391
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions JDBC.NET.Data/JdbcCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,13 @@ private void CloseStatement()
if (Connection is not JdbcConnection jdbcConnection)
throw new InvalidOperationException();

jdbcConnection.Bridge.Statement.closeStatement(new CloseStatementRequest
if (Connection.State != ConnectionState.Closed)
{
StatementId = StatementId
});
jdbcConnection.Bridge.Statement.closeStatement(new CloseStatementRequest
{
StatementId = StatementId
});
}

StatementId = null;
}
Expand All @@ -290,7 +293,7 @@ protected override void Dispose(bool disposing)
{
if (_isDisposed)
return;

CloseStatement();
_isDisposed = true;

Expand Down

0 comments on commit ed82391

Please sign in to comment.