Repository navigation
Conversation
The tests pin the messages for parameters that don't match the placeholders, the binding of each type of vector, parameter sets that return several rows, none, or that are empty, later sets that fail to bind in `dbBind()` or in a fetch, rebinding, and bound vectors across fetches. They pass before and after the binding moves into a parameter source. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4
The result binds its parameter sets through an abstract `SqliteParamSource`, so that a later source can bind parameters given in another form. `SqliteListParamSource` holds the list and binds its vectors as the result did, and throws the same `SqliteError` for a value that can't be bound. `db_bind()` gets `is_unnamed_placeholders()` and `match_placeholders()` for a later bind to share. No change of behavior. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4
… claude/rb-param-source Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4
The list parameter source moved on only after a set was bound, so after a refused set a further `bind_next_row()` would have bound the same set again. It now advances first, as the result did before the source, and the contract of `bind_next_row()` says so. The comment on `step()` notes that the run to the end of a statement takes each set from the parameter source too. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4
krlmlr
changed the base branch from
claude/rb-fetch-error-rows
to
claude/rb-returning-params
December 1, 2026 02:52
… claude/rb-param-source Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4
This was referenced Dec 1, 2026
This branch has not been deployed
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.
No change of behavior. The result binds its list parameters through a parameter source, so that a later layer can add an Arrow parameter source next to it.
What changes
SqliteResultImplbound list parameters itself:bind_row()reset the statement and bound one parameter set throughbind_parameter_pos(), whilegroup_andgroups_counted the sets. That code moves, unchanged apart from names, intoSqliteListParamSource, behind an abstractSqliteParamSourcewhose one method,bind_next_row(), resets the statement, binds the next set, and returns whether there was one. Like the result before, it moves on to the next set before binding it, so a set that fails to bind is never bound again. The result keeps the source of its latest bind in aboost::scoped_ptr;bind()replaces it, and a failed bind drops it, as it dropped the list before.check_bind(), the formerraise_bind_exception(j, rc)from #868, is a protected helper of the base class, so that every source names the parameter and the row in the same message and throws the sameSqliteErrorwith SQLite's extended result code (#943); a value of a type that can't be bound still throws aSqliteErrorwithSQLITE_ERROR. Soread_ahead()keeps the error of a later set for the next fetch, the error of a fetch carries the rows read before it (#945), and a failed bind leaves the result unbound (#936) as before.One line goes away:
raise_bind_exception()marked the result complete before throwing, which every caller already overrode (step()completes it,read_ahead()keeps the error with the result not complete,bind()leaves it unbound), so the source doesn't touch the result's state.A writing statement sent with
dbSendStatement()runs every parameter set to the end since #948; that loop instep()takes each further set from the parameter source too, throughstep_done()andbind_row(), and the newresult_create()argumentis_statementis left as #948 has it.On the R side,
db_bind()getsis_unnamed_placeholders()andmatch_placeholders(), taken from #855, for the Arrow bind to share later.match_placeholders()takes the parameters rather than their names, so that an unnamed list bound to a query without placeholders still gives "Named parameters not used in query: ".Tests
The first commit adds tests to
test-dbBind.Rthat pass on the base and on this branch: the messages for parameters that don't match the placeholders, the binding of each type of vector with missing values, parameter sets that return several rows, none, or that are empty, rebinding, and bound vectors across fetches withgc()in between. Three pin the seams of the new source: a later set that fails to bind indbBind()after earlier sets wrote, a later set that SQLite refuses indbBind()after a set that returned no row (classedRSQLite_error_toobig, result left unbound), and a later set that SQLite refuses in a fetch (classed error carrying the rows before it, row count, completion, rebinding). The full suite withNOT_CRAN=truegives the same counts on the base with the new tests and on this branch: FAIL 0, WARN 3 (locale), SKIP 63, PASS 11298. Each newtest_that()block passes on its own afterload_all(). Binding 200k sets of five columns through anINSERTand anUPDATEtakes the same time on both builds within noise, and a bind fetched row by row undergctorture()returns the right values.Limitations carried from #855
Both findings that #855 accepted still apply, unchanged by this pull request. #874: an R error that leaves the list source by longjmp, which only an ALTREP vector whose data pointer can't be taken triggers, is now handled in a fetch (
cpp11::unwind_protect()from #935) and for the first set indbBind()(the result is unbound from the start since #936), but not for a later set indbBind()after a set that returned no row; the interface comment says so. #873: rebinding with zero-length parameters after a partial fetch keeps the read lock until the next bind ordbClearResult().Chain
Layer R1 of the rebuilt chain, planned in #880; based on #948. Ported from #855 (now a draft), rewritten onto today's base; nothing Arrow-specific.
Coordinating session: https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4
Generated by Claude Code