Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open database readOnly not working #93

Closed
leonardoanalista opened this issue Feb 24, 2023 · 3 comments
Closed

Open database readOnly not working #93

leonardoanalista opened this issue Feb 24, 2023 · 3 comments

Comments

@leonardoanalista
Copy link

Hi there

I am trying to open the database in readOnly mode but it's not working.

My code:

const db = new Database("myfile.db", { readonly: true });

result:

error: Uncaught (in promise) SqliteError: 21: SQLite3 API misuse
    throw new SqliteError(code, "SQLite3 API misuse");
          ^
    at unwrap (https://deno.land/x/[email protected]/src/util.ts:36:11)
    at new Database (https://deno.land/x/[email protected]/src/database.ts:221:5)

V: 0.8.0

Thanks,

@DjDeveloperr
Copy link
Member

DjDeveloperr commented Feb 24, 2023

Thanks for reporting, I'll cut new patch release 0.8.2 for fixing this bug.

Workaround on old version: set create: false.

@leonardoanalista
Copy link
Author

Thanks. Is there any performance benefit to flag that we are opening for readonly? Just curious about it.

@DjDeveloperr
Copy link
Member

There most likely is some performance benefit, for example if DB is opened as read-only, we can set journal mode to off since no changes can be made to data.

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

No branches or pull requests

2 participants