Added:Support for read-only databases in the Rust crate.#347
Closed
xonx4l wants to merge 1 commit intotursodatabase:mainfrom
Closed
Added:Support for read-only databases in the Rust crate.#347xonx4l wants to merge 1 commit intotursodatabase:mainfrom
xonx4l wants to merge 1 commit intotursodatabase:mainfrom
Conversation
penberg
requested changes
Sep 1, 2023
| impl Database { | ||
| /// Open a local database file. | ||
| pub fn open<S: Into<String>>(db_path: S) -> Result<Database> { | ||
| pub fn open<S: Into<String>>(db_path: S, readonly:bool) -> Result<Database> { |
Collaborator
There was a problem hiding this comment.
We should do a open_with_flags() associate function like Rusqlite does for this instead of adding a boolean to open() that everybody has to pass.
Collaborator
|
Hey @xonx4l! Thanks for the pull request! I already commented on the |
penberg
reviewed
Sep 1, 2023
| .map_err(|e| ConnectionFailed(format!("{:?}", e))) | ||
| } | ||
|
|
||
| pub fn use_database(&self) -> Result<()> { |
Collaborator
There was a problem hiding this comment.
This looks like some left-over code.
penberg
reviewed
Sep 1, 2023
| pub fn connect(&self) -> Result<Connection> { | ||
| Connection::connect(self) | ||
| if self.readonly { | ||
| Connection::open_with_flags(&self.db_path, rusqlite::OpenFlags::SQLITE_RO) |
Collaborator
There was a problem hiding this comment.
You should use libsql-sys and SQLITE_OPEN_READONLY here.
Collaborator
|
Implemented in commit befd735. |
MarinPostma
added a commit
that referenced
this pull request
Oct 17, 2023
This was referenced Jan 18, 2026
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.
issue -:#344