-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[bun:sqlite] Support sqlite3_file_control
, better closing behavior, implement Disposable
#10262
Conversation
…support `using` statements
❌ @Jarred-Sumner 5 files with test failures on linux-x64-baseline: |
❌ @Jarred-Sumner 4 files with test failures on linux-x64: |
❌ @Jarred-Sumner 2 files with test failures on bun-darwin-aarch64:
|
❌ @Jarred-Sumner 8 files with test failures on bun-windows-x86_64-haswell
|
❌ @Jarred-Sumner 5 files with test failures on bun-darwin-x64:
|
@pekeler this might be an issue with our type declarations - have you tried running the code and seeing if it works? |
@gvilums the code works for simple use cases (ignoring the type errors). In scenarios where the DB is used for a bit more than one simple query, |
Hm, that does indeed sound like something is going wrong in bun. Could you open an issue for this? |
What does this PR do?
You can now manage the lifetime of a
Database
instance inbun:sqlite
via theusing
keyword:Database#fileControl
lets you use thesqlite3_file_control
APIFor example:
Automatically closing databases when the
Database
object GC'd was not implemented correctly before (bun would only automatically close the database before process exit). This has now been fixeddatabase.close(true)
will now throw an error if the database has any pending resources associated with it.Fixes #2537
How did you verify your code works?
Tests