Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For FBStatement, unprepare statement after statement completion [JDBC637] #667

Closed
firebird-automations opened this issue Mar 6, 2021 · 7 comments

Comments

@firebird-automations
Copy link

Submitted by: @mrotteveel

Internally, FBStatement also prepares the statement, and keeps it prepared until the next statement is executed. It would probably be a good idea to automatically unprepare (free with DSQL_unprepare) the statement on statement completion to prevent retention of existence locks.

Commits: 517b055

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Fix Version: Jaybird 4.0.3 [ 10981 ]

Fix Version: Jaybird 3.0.11 [ 10980 ]

Fix Version: Jaybird 5 [ 10871 ]

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Note that DSQL_unprepare was introduced in Firebird 2.5, so maybe calling free(DSQL_unprepare) on 2.1 and earlier should either be a no-op or do free(DSQL_close) instead.

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

There are some problems with doing this: getUpdateCounts can only be called after statement completion, and same goes for getLastExecutionPlan() and getLastExplainedExecutionPlan(). We could request those at statement completion, but if we do that, we should ask all of this in a single info request to avoid three extra roundtrips, or it might make more sense to (always) request the execution plans as part of prepare.

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Given this is more complicated than I first assumed, only implement this for Jaybird 5 (if there are no more hurdles)

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Fix Version: Jaybird 4.0.3 [ 10981 ] =>

Fix Version: Jaybird 3.0.11 [ 10980 ] =>

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

I committed an unprepare method for FbStatement and implementations, but this is not called from JDBC yet.

@mrotteveel
Copy link
Member

The complications with the lifetime requirements has made may decide not to implement this.

@mrotteveel mrotteveel closed this as not planned Won't fix, can't repro, duplicate, stale Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants