drizzle-team / drizzle-team/drizzle-orm
[BUG]: `expo-sqlite` statements are never finalized
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Report hasn't been filed before.
- [x] I have verified that the bug I'm about to report hasn't been filed before.
### What version of `drizzle-orm` are you using?
0.39.3
### What version of `drizzle-kit` are you using?
0.30.4
### Other packages
expo-sqlite@15.1.4
### Describe the Bug
`drizzle-orm` prepares and executes statements using `expo-sqlite`, but never finalizes them, resulting in resource leaks and erroneously retained locks.
See the `expo-sqlite` documentation for `finalizeSync/finalizeAsync` [here](https://github.com/expo/expo/blob/84079fa454e3498329f127b8e71fb08d2390bbd0/packages/expo-sqlite/src/SQLiteStatement.ts#L185).
The intended usage flow of `expo-sqlite`'s `SQLiteStatement` class is `prepareSync` -> `executeSync` -> `finalizeSync`.
A number of prebuilt methods are provided by the `expo-sqlite` `SQLiteDatabase` class, such as [`runSync`](https://github.com/expo/expo/blob/84079fa454e3498329f127b8e71fb08d2390bbd0/packages/expo-sqlite/src/SQLiteDatabase.ts#L364), which demonstrate this intention.
Looking at the current implementations in [`session.ts`](https://github.com/drizzle-team/drizzle-orm/blob/0.39.3/drizzle-orm/src/expo-sqlite/session.ts), we can see that the `finalizeSync` step is missing in all flows.
Potentially related:
- https://github.com/drizzle-team/drizzle-orm/issues/4068
Contributor guide
Assessment
This issue has not been assessed yet.