Skip to content

deadpool-sqlite: add OpenFlags config for read-only connections - #500

Open
ChrisJr404 wants to merge 2 commits into
deadpool-rs:mainfrom
ChrisJr404:sqlite-open-flags
Open

deadpool-sqlite: add OpenFlags config for read-only connections#500
ChrisJr404 wants to merge 2 commits into
deadpool-rs:mainfrom
ChrisJr404:sqlite-open-flags

Conversation

@ChrisJr404

Copy link
Copy Markdown

Fixes #446.

deadpool-sqlite always opened connections with rusqlite::Connection::open, so there was no way to get a read-only connection like the issue asks for. This adds an optional flags field to Config plus a small serde-friendly OpenFlags type, and opens with open_with_flags when it is set. When flags is None the behaviour is unchanged.

I followed the same shape deadpool-libsql already uses for its OpenFlags so the two crates stay consistent and it keeps working with the config crate. Added a test that opens a read-only pool and checks reads succeed while writes are rejected.

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.

deadpool-sqlite: Obtain read-only connection

2 participants