Support direct DBInterface parameter binding - #242
Merged
Conversation
Prepare connection-level parameterized queries for one execution. Retain the temporary statement on the returned cursor so its bind buffers and C handle stay valid through result consumption and explicit close. Add regression coverage for DML, NULL values, last-row IDs, buffered and streaming results, garbage collection, and date/time conversion.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #242 +/- ##
==========================================
+ Coverage 71.50% 71.68% +0.17%
==========================================
Files 10 10
Lines 1260 1275 +15
==========================================
+ Hits 901 914 +13
- Misses 359 361 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DBInterface.execute(conn, sql, params)by preparing the statement for one executionnothing, last-row IDs, buffered and streaming reads, garbage collection, and date/time conversionRoot cause
MySQL.jl overrode DBInterface's connection-level fallback and explicitly rejected every non-empty parameter set, even though the package documentation described the call as supported. Calling the prepared-statement path alone was not sufficient because the returned cursor can outlive the convenience call. The cursor now owns the temporary statement for that lifetime.
Impact
Portable DBInterface code can use the same connection-level parameterized execution form with MySQL.jl, SQLite.jl, and Postgres.jl. Callers that execute the same SQL repeatedly should still use
DBInterface.prepareto reuse the statement.This completes the remaining behavior from #238. PR #239 already fixed
nothingbinding and transaction return values.Validation
git diff --checkpassedCloses #238
Co-authored by Codex