Visitar URL original
Keep URI parameters when cipher_migrate reopens the main database by LucaCappelletti94 · Pull Request #629 · sqlcipher/sqlcipher · GitHub
Skip to content

Keep URI parameters when cipher_migrate reopens the main database - #629

Open
LucaCappelletti94 wants to merge 1 commit into
sqlcipher:betafrom
LucaCappelletti94:upstream/beta-cipher-migrate-uri-filename
Open

LucaCappelletti94 wants to merge 1 commit into
sqlcipher:betafrom
LucaCappelletti94:upstream/beta-cipher-migrate-uri-filename

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

PRAGMA cipher_migrate reopens the main database by sqlite3_db_filename(db, "main") without SQLITE_OPEN_URI. That name is the pager's own filename, so when the database was opened through a URI such as file:test.db?psow=0 its parameters follow the terminator and the VFS is told to ignore them. A SQLITE_DEBUG build aborts in unixOpen on the assertion that guards this, and a release build migrates but drops the parameters the VFS reads at open time, so psow=0 is lost after migration.

Adding SQLITE_OPEN_URI to both reopens, the normal one and the one in the error handler, is always valid for a name the pager produced. A name without parameters is double-zero terminated, so it behaves exactly as before.

The new tests migrate the 3.0 and 4.0 fixtures opened with psow=0, plus the error-handler path through fail_migrate_closed, and check the row count and that psow stays off. They fail on beta in both debug and release builds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant