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

On Android, allow PRAGMA statements that assign when invoked via exec #99

Merged
merged 2 commits into from
Aug 5, 2021
Merged

On Android, allow PRAGMA statements that assign when invoked via exec #99

merged 2 commits into from
Aug 5, 2021

Conversation

ilmoraunio
Copy link
Contributor

Fixes the following error on Android

{"error": {"error": [Error: unknown error (code 0): Queries can be performed using SQLiteDatabase query or rawQuery methods only.], "insertId": undefined, "rows": undefined, "rowsAffected": undefined}}

when accessing exec directly to try to run assigning PRAGMA statements, such as PRAGMA journal_mode = WAL.

@craftzdog
Copy link
Owner

@ilmoraunio
Copy link
Contributor Author

Ah, will add.

@ilmoraunio
Copy link
Contributor Author

Added some tests and also tested them on Android & iOS.

Copy link
Owner

@craftzdog craftzdog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Can you fix them?

new Promise((resolve) => {
let sql = "PRAGMA journal_mode"
db._db.exec([{sql: sql, args: []}], false, (_, result) => {
journal_mode = result[0].rows[0].journal_mode
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add const or it causes ReferenceError

new Promise((resolve) => {
let sql = "PRAGMA main.wal_checkpoint(FULL)"
db._db.exec([{sql: sql, args: []}], false, (_, result) => {
row = result[0].rows[0]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add const or it causes ReferenceError

@craftzdog craftzdog merged commit e19a3c5 into craftzdog:master Aug 5, 2021
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.

None yet

2 participants