Repository navigation
Conversation
|
Review of this pull request at a0189d3, by a Claude Code reviewer with clean context that read the description, the diff against What was run
What holds
HighNone. Medium
Low
Generated by Claude Code |
|
Review of the fixes in this pull request at ff7fc0b (the commits since a0189d3), by a Claude Code reviewer with clean context that read the description, the first review, the diff a0189d3..ff7fc0b with the rest of the pull request as context, the driver method the arguments are matched against and the DBI generic, built ff7fc0b and What was run
What holds
HighNone. Medium
Low
Generated by Claude Code |
|
Review of the fixes in this pull request at 43dd7e7 (the commit since ff7fc0b), by a Claude Code reviewer with clean context that read the description, the second review, the diff ff7fc0b..43dd7e7 with the rest of the pull request as context and the driver method the arguments are passed to, built 43dd7e7, ff7fc0b and What was run
What holds
HighNone. MediumNone. Low
Generated by Claude Code |
Superseded: Accepted limitationsSuperseded by the current copy. Three review rounds: the first found that
Generated by Claude Code |
Superseded: Accepted limitationsSuperseded by the current copy. Three review rounds: the first found that
Generated by Claude Code |
|
Make this a stacked PR on top of #846, also copy over the newly introduced arg there. |
|
Re #852 (comment): this is now stacked on #846, and as of 68f541a a cloned connection keeps the original's Generated by Claude Code |
dbConnect() on a connection keeps bigint and extended_typesdbConnect() on a connection keeps bigint, extended_types and check_utf8
Question: treat a missing
|
Accepted limitationsFour review rounds: the first found that
This one is older:
Generated by Claude Code |
`dbConnect()` on an existing connection passed on the database, the VFS, the flags and the extensions, but not `bigint` and `extended_types`. The clone fell back to `integer64` and to untyped dates and times. It now passes both on. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd3gjmufoKCWVDBPCgE
The clone now takes the database, VFS, flags, extensions, `bigint` and `extended_types` of the original as defaults. Arguments to `dbConnect(con, ...)` are matched against the driver method by name and by position and override them. A temporary database can still not be cloned, unless another `dbname` is given. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd3gjmufoKCWVDBPCgE
`modifyList()` dropped arguments that are `NULL`, so `synchronous = NULL` ran the clone with `synchronous = "off"` and `dbname = NULL` fell back to the original database instead of failing as the driver does. The defaults are now added only for the arguments that were not given. The check for a temporary database reads `dbname` by exact name, so a misspelled `dbname` still errors. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd3gjmufoKCWVDBPCgE
A connection to a temporary database can only be used as a template for a connection to another `dbname`: its settings carry over, its data does not. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd3gjmufoKCWVDBPCgE
…ead of matching the call `dbConnect_SQLiteConnection()` now has the formals of `dbConnect_SQLiteDriver()`, in the same order, with the connection's own `dbname`, `vfs`, `flags`, `loadable.extensions`, `bigint`, `extended_types` and `check_utf8` as defaults. It passes every argument by name to `dbConnect_SQLiteDriver()`, so explicit `NULL` arguments and positional matching behave as before. A test checks that the formals stay in step with the driver method. A clone now also keeps `check_utf8` unless it is overridden, and the documentation no longer says that it does not. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd432Aef98ibnZSSsYn
A mocked `dbConnect_SQLiteDriver()` records the arguments it receives, so an argument added to the formals but left out of the forwarding call is caught, as is a default that no longer comes from the connection. The error for `dbname = NULL` is now pinned by its message. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7mthffYErGmWTGDfQ
A connection object saved before the `bigint`, `extended_types` or `check_utf8` slots existed lacks them, so `dbConnect()` on it failed with "no slot of name". The missing settings now fall back to the defaults of `dbConnect()` on the driver. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7mthffYErGmWTGDfQ
6739682 to
0d85a42
Compare
Calling
dbConnect()on an existingSQLiteConnectionclones it, but the clone passed on only the database, the VFS, the flags andloadable.extensions, and ignored every argument given todbConnect(con, ...). It droppedbigintandextended_types, so a clone of a connection opened withbigint = "character", extended_types = TRUEfell back tointeger64and to untyped dates and times. It also droppedcheck_utf8, added in #846, so a clone of a connection that checks text for valid UTF-8 did not check it.Reproduced on
mainwith a connection opened withbigint = "character", extended_types = TRUEon a table with aDATEcolumn and the value 1099511627776:dasDateandbigaschr "1099511627776";daschr "2020-01-02"andbigasinteger64, andclone@bigintis"integer64"andclone@extended_typesisFALSE.dbConnect_SQLiteConnection()now has explicit formals that mirror those ofdbConnect_SQLiteDriver(), with the connection'sdbname,loadable.extensions,flags,vfs,bigint,extended_typesandcheck_utf8slots as defaults, and passes every argument on to the driver method. So arguments todbConnect(con, ...)are matched by name and by position asdbConnect(SQLite(), ...)would match them:dbConnect(con, bigint = "integer64"),dbConnect(con, extended_types = FALSE)anddbConnect(con, check_utf8 = FALSE)return what is asked, anddbConnect(con, other_path)opensother_path. The formals also show up in completion and inargs(). A connection object saved by an older RSQLite, before thebigint,extended_typesorcheck_utf8slots existed, lacks those slots; for it, they fall back to the driver's defaults ("integer64",FALSE,FALSE) instead of failing withno slot of name. An argument that isNULLstaysNULL, as in the driver:synchronous = NULLskips the pragma anddbname = NULLfails with the driver's error,length(dbname) == 1 is not TRUE(before this change, onmain, aNULLdbnameon a connection was not an error but opened a new temporary database). The error for cloning a temporary database remains, unless anotherdbnameis given, and a misspelleddbnamedoes not count as one. The documentation ofdrv, connsays what a clone keeps, and that a connection to a temporary database is only a template for anotherdbname: its settings carry over, its data does not. The note undercheck_utf8that a clone does not keep it is removed.Effects beyond reads, now consistent with the parent:
extended_types = TRUEparent, aDatecolumn is created asDATEinstead ofREAL.bigint = "integer"parent now returnsNAfor values beyond 32 bits, like the parent, instead ofinteger64.check_utf8 = TRUEparent warns and returnsNAfor text that is not valid UTF-8, like the parent.Accepted limitations, not changed here:
default.extensions,synchronousandcache_sizeare not carried over (a parent opened withsynchronous = "full"clones with"off",cache_size = 1234becomes SQLite's default of -2000).flags,vfsandloadable.extensionswere already kept. A wrapper that passes on a missingdbnamenow gets the driver's error.Tests, in
tests/testthat/test-dbConnect.R, each self-contained, thirteen new: a clone keepsbigintandextended_typesand reads and types data accordingly; a clone keepscheck_utf8unless overridden; a clone of a default connection has the defaults;bigintandextended_typesarguments override the parent; a second positional argument is the database; a connection to a temporary database can be used as a template for anotherdbname;NULLarguments are kept (synchronous = NULL, anddbname = NULLfails with the driver's message); a misspelleddbnamedoes not clone a temporary database; a temporary database cannot be cloned otherwise; the formals match those of the driver method, with the same defaults except for the ones taken from the connection; with the driver method mocked, each formal and any extra argument reaches it unchanged; and each default comes from the matching slot of the connection (default.extensionsfromloadable.extensions); and a connection object without thebigint,extended_typesandcheck_utf8slots, as an old saved one looks, clones with the driver's defaults. Run against the base, ten of the thirteen fail and three pass (defaults, misspelleddbname, temporary cannot be cloned). Leavingcheck_utf8out of the forwarding call, or taking theflagsdefault from elsewhere, makes the mocked tests fail.test-dbConnect.Rpasses in full (24 tests, 85 expectations, with the package installed for thecallrtest).devtools::test()passes except the three known errors intest-httpvfs.R(#832, #837) and, without an installed build, the one test that starts acallrsession.The pull request sits on #846, which adds
check_utf8.NEWS.mdis maintained by fledge, so it is not edited. The fix comes from the old Arrow stack (01946d8 in #795); the plan to rework that stack splits it out as a separate pull request. Three review rounds (first, second, third) led to ff7fc0b, 43dd7e7 and 5ac4a57. The explicit formals, asked for after those rounds, had a clean review of their own at 68f541a that found nothing above Low; its fixes are d66dfdd (tests that every argument reaches the driver and every default comes from the connection) and 48ef91f (the fallback for missing slots); see the accepted limitations. Squash-merge, so that the commit messages of the fixes do not reachmain.https://claude.ai/code/session_01Hr1rd7mthffYErGmWTGDfQ
Generated by Claude Code