-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[sqlite] add experimental promise support #23109
Conversation
ENG-8685 Implementing SQLite to use promises does not work on the second step in a transaction
This issue was automatically imported from GitHub: #13357Issue accepted by kudoSummary:
|
): Promise<void> { | ||
await this.execAsync([{ sql: 'BEGIN;', args: [] }], false); | ||
try { | ||
const transaction = new ExpoSQLTransactionAsync(this, readOnly); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out of curiosity - how did you decide on wrapping this in an ExpoSQLTransaction
class rather than inlining the execAsync
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the idea is to make transactionAsync
like transaction
but only for async mode. for transaction
, it gives you a transaction interface and that is actually a wrapped WebSQLTransaction
as well.
i'm open to the design, feel free to comment if there's any thought.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds reasonable, thanks for clarifying!
26a4e4f
to
5688cea
Compare
landing this pr because it doesn't have other concerns and it's experimental. |
Hello, Thanks for this change! I discovered the transactional problem in my code today (trying to wrap promises around it) and then discovered this thread and the new expo-sqlite 11.3.1. I've integrated this and I noticed a few things I'd like to share; hopefully this is an OK place:
and I assumed that this could be fixed by building an expo-dev-client, which it did. I didn't see this in the documentation but 11.3.1 isn't an approved SDK 48.0.0 package, so I'd assume that also means it doesn't get built into Expo Go either, at least not yet? |
hi there! this feature is available in sdk 49 and it's now public beta. |
This is an interesting situation I saw too. Make sure you install this using |
Thanks! Hey I believe I found a typing error in the code here: This will cause errors to go unnoticed, at least for me, until I checked that the property |
# Why fixes #23667 close ENG-9446 # How - from #23109, we moved the returned type of `openDatabase()` from `WebSQLDatabase` to `SQLiteDatabase`. however some properties from websql like the `transaction` and `readTransaction` are missing from `SQLiteDatabase`. this pr tries to add those missing properties. - migrates **test-suite/tests/SQLite** to typescript based which to dogfood our typings - update generated doc # Test Plan - test test-suite SQLite from ios bare-expo - run `yarn tsc` from **apps/test-suite**
fixes #23667 close ENG-9446 - from #23109, we moved the returned type of `openDatabase()` from `WebSQLDatabase` to `SQLiteDatabase`. however some properties from websql like the `transaction` and `readTransaction` are missing from `SQLiteDatabase`. this pr tries to add those missing properties. - migrates **test-suite/tests/SQLite** to typescript based which to dogfood our typings - update generated doc - test test-suite SQLite from ios bare-expo - run `yarn tsc` from **apps/test-suite** (cherry picked from commit c52e83e)
Am I wrong thinking that there should be some sort of locks (or a queue like in
In |
Why
fixes #13357
close ENG-8685
How
or '.then
inside the callback, the statement will be executed after the "transaction end" statement.execAsync
transactionAsync
usage
ResultSet
type but not theSQLResultSet
type. people can access the result items byrows[0]
rather thanrows.item(0)
. i was thinking to deprecate websql somehow and it doesn't make sense to wrap the result by theWebSQLResultSet
againTest Plan
add some SQLite Async unit tests and test suite ci should be passed
Checklist
npx expo prebuild
& EAS Build (eg: updated a module plugin).