+8
−1
+59
−0
+83
−53
Loading
applyQueryParams validated each parameter as it reached it, so a DSN whose last parameter was bad still executed every PRAGMA ahead of it before failing. PRAGMA journal_mode and auto_vacuum are persistent changes to the database file, so file:x.db?_journal_mode=wal&_synchronous=bogus failed the connection and left x.db converted to WAL regardless. A failed Open must not change the database. Split the function into a validation phase and an apply phase: everything checkable is rejected before the first c.exec. Assignments to c stay in the validation phase, since newConn closes and discards the connection when this returns an error and they cannot outlive the failure. The documented apply order is unchanged and still covered by the combined-DSN test. This predates the !134 shorthand keys - master already behaved this way for _pragma combined with a late-rejected _txlock, which is why the new test covers that case too. _pragma remains the one parameter that can still fail partway, as its values are executed verbatim and cannot be checked up front. Co-Authored-By:Claude Opus 4.8 <noreply@anthropic.com>