| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Review requested:
|
Sorry, something went wrong.
|
We are currently finalizing statements when the wrapper is deconstructed after GC. This PR only makes sense if we are going to change this to an explicit "user should finalize statements themselves" model, in which case we should also expose a named .finalize() method that does the same thing. If not, then this probably isn't a logical addition. |
Sorry, something went wrong.
I think we can support both approaches. I don't see any issue with that. We can either let the GC finalize statements as they are today, or let users finalize them explicitly with a dispose() or the using keyword. The choice is theirs. Explicit finalization is very useful in memory-constrained environments. |
Sorry, something went wrong.
Honestly, I'm not a fan at all of relying on GC timing. It's too unpredictable and can expose GC timing details (which can be problematic on its own). We originally had FileHandle automatically close on GC but have since backed away from that to require explicit closing. I think it makes sense to do the same here. |
Sorry, something went wrong.
|
That's the case I had in mind. I don't have a problem with the approach, we just need to be very clear to consumers that the contract is changing. |
Sorry, something went wrong.
This extends explicit resource management support to prepared statements, allowing a StatementSync to be deterministically finalized via a `using` declaration, mirroring the existing DatabaseSync and Session dispose methods. Signed-off-by: Guilherme Araújo <arauujogui@gmail.com>
Signed-off-by: Guilherme Araújo <arauujogui@gmail.com>
Signed-off-by: Guilherme Araújo <arauujogui@gmail.com>
Signed-off-by: Guilherme Araújo <arauujogui@gmail.com>
There was a problem hiding this comment.
LGTM. As a follow-up, we should update all of the statement examples in sqlite.md to demonstrate explicit teardown.
Sorry, something went wrong.
Codecov Report❌ Patch coverage is 87.50000% with 2 lines in your changes missing coverage. Please review.
@@ Coverage Diff @@
## main #64232 +/- ##
==========================================
- Coverage 90.25% 90.24% -0.02%
==========================================
Files 741 741
Lines 241165 241177 +12
Branches 45428 45426 -2
==========================================
- Hits 217667 217643 -24
- Misses 15069 15114 +45
+ Partials 8429 8420 -9
... and 34 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
Sorry, something went wrong.
This extends explicit resource management support to prepared statements, allowing a StatementSync to be deterministically finalized via a `using` declaration, mirroring the existing DatabaseSync and Session dispose methods. Signed-off-by: Guilherme Araújo <arauujogui@gmail.com> PR-URL: #64232 Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Signed-off-by: Guilherme Araújo <arauujogui@gmail.com> PR-URL: #64232 Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Statements could only be finalized by garbage collection or by closing the database, so there was no way to release one deterministically and `using stmt = db.prepare(...)` did nothing. close() finalizes the statement and stops the database tracking it. It throws ERR_INVALID_STATE if the statement is already finalized, if it is currently executing, or if it is called from inside an authorizer callback: finalizing a statement whose sqlite3_step() is on the stack is undefined behavior, and sqlite3_finalize() modifies the connection, which SQLite forbids from an authorizer. That second guard is what every other statement method already does, and is an intentional divergence from node:sqlite, which has no authorizer guard at all. Symbol.dispose never throws, so both unsafe cases become no-ops there and the statement is finalized later by GC or database close. Also drops FinalizeStatement() and FinalizedGetter(), which were never registered on the prototype and so were unreachable. Ports nodejs/node#64232.
This extends explicit resource management support to prepared statements, allowing a StatementSync to be deterministically finalized via a `using` declaration, mirroring the existing DatabaseSync and Session dispose methods. Signed-off-by: Guilherme Araújo <arauujogui@gmail.com> PR-URL: #64232 Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Signed-off-by: Guilherme Araújo <arauujogui@gmail.com> PR-URL: #64232 Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
This extends explicit resource management support to prepared statements, allowing a StatementSync to be deterministically finalized via a `using` declaration, mirroring the existing DatabaseSync and Session dispose methods. Signed-off-by: Guilherme Araújo <arauujogui@gmail.com> PR-URL: #64232 Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Signed-off-by: Guilherme Araújo <arauujogui@gmail.com> PR-URL: #64232 Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Notable changes: benchmark: * (SEMVER-MINOR) add --analyze mode to compare.js (James M Snell) #65416 crypto: * update root certificates to NSS 3.126 (Node.js GitHub Bot) #65495 * (SEMVER-MINOR) enable SIV and GCM-SIV modes in Cipher/Decipher APIs (Filip Skokan) #63411 diagnostics_channel: * mark TracingChannel as stable (Abdelrahman Awad) #64525 lib,src: * (SEMVER-MINOR) improve histogram implementation (James M Snell) #65024 net: * (SEMVER-MINOR) improve performance of net.BlockList (James M Snell) #64974 perf_hooks: * (SEMVER-MINOR) add statistical hypothesis testing to histogram (James M Snell) #65416 repl: * add basic syntax highlighting (Aviv Keller) #64591 sqlite: * (SEMVER-MINOR) add StatementSync.prototype.close() (Guilherme Araújo) #64232 * (SEMVER-MINOR) add StatementSync.prototype[Symbol.dispose]() (Guilherme Araújo) #64232 util: * (SEMVER-MINOR) add non-throwing MIMEType.parse (James M Snell) #64965 zlib: * (SEMVER-MINOR) add ZipEntry, ZipFile, and ZipBuffer (Philipp Dunkel) #64339 PR-URL: #65551
| Back | FazBrowse Home | New Git URL |
No description provided.