Anna Henningsen
fbfbc83809
src: make AsyncWrap subclass internal field counts explicit
...
This helps ensure that we already set the correct number of
internal fields when creating objects, even if the number of
internal fields of e.g. AsyncWrap changes over time.
PR-URL: https://github.com/nodejs/node/pull/62103
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2026-07-19 17:30:55 -05:00
Ali Hassan
bf3ff4b226
sqlite: avoid extra copy for large text binds
...
When binding UTF-8 strings to prepared statements, transfer ownership of
malloc-backed Utf8Value buffers to SQLite to avoid an extra copy for
large strings. Use sqlite3_bind_blob64() when binding BLOB parameters.
PR-URL: https://github.com/nodejs/node/pull/61580
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com >
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk >
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com >
2026-07-19 17:30:39 -05:00
Anna Henningsen
37b4a82a97
src: use Utf8Value and TwoByteValue instead of V8 helpers
...
Our own helper classes have the advantage of using stack storage
a lot of the time, so they should always be preferred.
PR-URL: https://github.com/nodejs/node/pull/60244
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ilyas Shabi <ilyasshabi94@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Vladimir Morozov <vmorozov@microsoft.com >
2026-07-17 17:07:34 -05:00
Bart Louwers
e4a4f63019
sqlite: fix crash session extension callbacks with workers
...
PR-URL: https://github.com/nodejs/node/pull/59848
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com >
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com >
2025-10-11 20:49:14 +02:00
Moonki Choi
8e182e561f
src: remove unnecessary Environment::GetCurrent() calls
...
PR-URL: https://github.com/nodejs/node/pull/59814
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de >
2025-10-11 20:49:13 +02:00
Moonki Choi
26b40bad02
src: replace FIXED_ONE_BYTE_STRING with Environment-cached strings
...
PR-URL: https://github.com/nodejs/node/pull/59891
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de >
2025-10-07 17:29:38 +02:00
Edy Silva
0c2b6df94f
src,sqlite: refactor value conversion
...
PR-URL: https://github.com/nodejs/node/pull/59659
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com >
2025-09-20 06:16:29 +00:00
Alex Yang
5559456fe4
sqlite: add sqlite-type symbol for DatabaseSync
...
PR-URL: https://github.com/nodejs/node/pull/59405
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com >
2025-09-20 06:10:28 +00:00
Edy Silva
3478130da3
sqlite: handle ?NNN parameters as positional
...
PR-URL: https://github.com/nodejs/node/pull/59350
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com >
2025-09-20 06:10:19 +00:00
Tobias Nießen
312bc4e5d1
sqlite: avoid useless call to FromMaybe()
...
PR-URL: https://github.com/nodejs/node/pull/59490
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
2025-09-20 03:33:42 +00:00
Miguel Marcondes Filho
ccca1517f9
sqlite: add support for readBigInts option in db connection level
...
PR-URL: https://github.com/nodejs/node/pull/58697
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Daniel Lemire <daniel@lemire.me >
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com >
2025-07-24 20:08:27 +02:00
Colin Ihrig
9d8677bff5
sqlite: handle thrown errors in result callback
...
This commit updates the aggregate function 'result' callback
handling to not crash when an exception is thrown.
Fixes: https://github.com/nodejs/node/issues/58425
PR-URL: https://github.com/nodejs/node/pull/58426
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com >
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2025-06-10 14:52:21 +02:00
Livia Medeiros
3490c75760
sqlite: set name and length on sqlite.backup()
...
PR-URL: https://github.com/nodejs/node/pull/58251
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2025-06-10 14:52:12 +02:00
Jonas
678e8f57c0
src: add dcheck_eq for Object::New constructor calls
...
PR-URL: https://github.com/nodejs/node/pull/57943
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2025-05-19 12:14:09 +02:00
Edy Silva
010dd91a19
src: fix typo in comments
...
PR-URL: https://github.com/nodejs/node/pull/57868
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Qingyu Deng <i@ayase-lab.com >
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com >
2025-05-19 12:14:08 +02:00
Chengzhong Wu
e00c1ecbd2
src: add BaseObjectPtr nullptr operations
...
Allow comparing a `BaseObjectPtr` or implicitly construct a
`BaseObjectPtr` with `nullptr`.
PR-URL: https://github.com/nodejs/node/pull/56585
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2025-05-19 12:14:08 +02:00
Edy Silva
7485309d7e
sqlite: add location method
...
PR-URL: https://github.com/nodejs/node/pull/57860
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2025-05-19 12:14:08 +02:00
Edy Silva
c12cd2a190
sqlite: add timeout options to DatabaseSync
...
PR-URL: https://github.com/nodejs/node/pull/57752
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2025-05-19 12:14:07 +02:00
Edy Silva
8856712171
sqlite,doc,test: add aggregate function
...
PR-URL: https://github.com/nodejs/node/pull/56600
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-05-19 12:14:07 +02:00
Gürgün Dayıoğlu
5e0503a967
sqlite: add setReturnArrays method to StatementSync
...
PR-URL: https://github.com/nodejs/node/pull/57542
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2025-05-19 12:14:07 +02:00
Edy Silva
120050db97
sqlite,src: refactor sqlite value conversion
...
PR-URL: https://github.com/nodejs/node/pull/57571
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2025-05-19 12:14:07 +02:00
Colin Ihrig
06dcb318bc
sqlite: refactor prepared statement iterator
...
This commit refactors the StatementSync iterator implementation
in two primary ways:
- The iterator internal state is no longer exposed to JavaScript.
- The iterator prevents the prepared statement from being GC'ed.
Fixes: https://github.com/nodejs/node/issues/57493
PR-URL: https://github.com/nodejs/node/pull/57569
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com >
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com >
2025-05-19 12:14:07 +02:00
Colin Ihrig
c510391d2f
sqlite: add StatementSync.prototype.columns()
...
This commit adds a method for retrieving column metadata from
a prepared statement.
Fixes: https://github.com/nodejs/node/issues/57457
PR-URL: https://github.com/nodejs/node/pull/57490
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com >
2025-05-19 12:14:07 +02:00
Colin Ihrig
4e24456a1a
sqlite: reset statement immediately in run()
...
This commit updates StatementSync.prototype.run() to reset the
prepared statement immediately after calling sqlite3_step() to
return the correct change metadata.
Fixes: https://github.com/nodejs/node/issues/57344
PR-URL: https://github.com/nodejs/node/pull/57350
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
2025-05-19 12:14:07 +02:00
Colin Ihrig
a9a6891b0b
sqlite: fix coverity warnings related to backup()
...
This commit fixes several coverity warnings related to the
recently landed backup() API.
PR-URL: https://github.com/nodejs/node/pull/56961
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-05-19 12:14:06 +02:00
Edy Silva
20b27331c0
sqlite, test: expose sqlite online backup api
...
PR-URL: https://github.com/nodejs/node/pull/56253
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
2025-05-19 12:14:06 +02:00
Divy Srivastava
d2e1bcf3d4
sqlite: fix use-after-free in StatementSync due to premature GC
...
PR-URL: https://github.com/nodejs/node/pull/56840
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-05-19 12:14:06 +02:00
Colin Ihrig
cfe15ca7b4
sqlite: handle conflicting SQLite and JS errors
...
This commit adds support for the situation where SQLite is
trying to report an error while JavaScript already has an
exception pending.
Fixes: https://github.com/nodejs/node/issues/56772
PR-URL: https://github.com/nodejs/node/pull/56787
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2025-05-19 12:14:06 +02:00
Colin Ihrig
0e999eb65f
sqlite: add getter to detect transactions
...
This commit adds an isTransaction getter to the DatabaseSync
class for determining if the database is currently within a
transaction.
Fixes: https://github.com/nodejs/node/issues/57922
PR-URL: https://github.com/nodejs/node/pull/57925
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com >
2025-05-19 12:14:00 +02:00
Colin Ihrig
bd5c90654a
sqlite: add support for unknown named parameters
...
This commit adds a method for toggling support for unknown named
parameters in prepared statements.
Fixes: https://github.com/nodejs/node/issues/55533
PR-URL: https://github.com/nodejs/node/pull/57552
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-04-17 10:51:51 -03:00
Colin Ihrig
ec571382a4
sqlite: add DatabaseSync.prototype.isOpen
...
This commit adds a getter to indicate whether or not the database
is currently open.
Fixes: https://github.com/nodejs/node/issues/57521
PR-URL: https://github.com/nodejs/node/pull/57522
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com >
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2025-04-17 10:51:48 -03:00
James M Snell
04de550289
src: make even more improvements to error handling
...
PR-URL: https://github.com/nodejs/node/pull/57264
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2025-04-17 10:51:23 -03:00
Colin Ihrig
6067bea027
sqlite: restore changes from #55373
...
PR #55373 introduced a performance improvement for the all()
method of prepared statements. Those changes appear to have been
accidentally overwritten in #54181 . This change restores the
overwritten code.
Refs: https://github.com/nodejs/node/pull/55373
Refs: https://github.com/nodejs/node/pull/54181
PR-URL: https://github.com/nodejs/node/pull/56908
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2025-04-16 03:29:12 -03:00
James M Snell
f41bc4cfd7
src: improve error handling in node_sqlite
...
PR-URL: https://github.com/nodejs/node/pull/56891
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2025-04-16 03:29:11 -03:00
René
bc672fcfdd
sqlite: allow returning ArrayBufferViews from user-defined functions
...
PR-URL: https://github.com/nodejs/node/pull/56790
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-04-16 03:26:27 -03:00
Yagiz Nizipli
a68f127a30
src: reduce string allocations on sqlite
...
PR-URL: https://github.com/nodejs/node/pull/57227
Backport-PR-URL: https://github.com/nodejs/node/pull/57533
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com >
2025-03-31 17:57:10 -03:00
Edy Silva
227603dc30
sqlite,test,doc: allow Buffer and URL as database location
...
PR-URL: https://github.com/nodejs/node/pull/56991
Backport-PR-URL: https://github.com/nodejs/node/pull/57533
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2025-03-31 17:56:50 -03:00
James M Snell
76921b822b
src: minor cleanups on OneByteString usage
...
* Provide a OneByteString variant that accepts std::string_view
* Use FIXED_ONE_BYTE_STRING in appropriate places
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/56482
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2025-02-03 20:09:56 +01:00
Alex Yang and Antoine du Hamel
07ff3ddcb5
sqlite: support TypedArray and DataView in StatementSync
...
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/56385
Fixes: https://github.com/nodejs/node/issues/56384
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2025-02-03 20:09:54 +01:00
Bart Louwers
3462263e8b
sqlite: pass conflict type to conflict resolution handler
...
PR-URL: https://github.com/nodejs/node/pull/56352
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-01-31 01:16:46 +01:00
Edigleysson Silva (Edy)
97c38352d0
sqlite: aggregate constants in a single property
...
PR-URL: https://github.com/nodejs/node/pull/56213
Fixes: https://github.com/nodejs/node/issues/56193
Refs: https://github.com/nodejs/node/issues/56193
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
2025-01-05 13:05:33 -05:00
Colin Ihrig
2268c1ea8b
sqlite: add support for custom functions
...
This commit adds support to node:sqlite for defining custom
functions that can be invoked from SQL.
Fixes: https://github.com/nodejs/node/issues/54349
PR-URL: https://github.com/nodejs/node/pull/55985
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-01-05 13:05:28 -05:00
Alex Yang
f5c6955722
sqlite: support db.loadExtension
...
PR-URL: https://github.com/nodejs/node/pull/53900
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2025-01-05 13:05:27 -05:00
tpoisseau
b4041e554a
sqlite: add StatementSync.prototype.iterate method
...
PR-URL: https://github.com/nodejs/node/pull/54213
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2025-01-05 12:57:23 -05:00
Bart Louwers
457e73f4c9
sqlite: add support for SQLite Session Extension
...
PR-URL: https://github.com/nodejs/node/pull/54181
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2024-11-27 11:03:37 -05:00
Michaël Zasso
6858f7a4d3
src: use env strings to create sqlite results
...
PR-URL: https://github.com/nodejs/node/pull/55785
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2024-11-27 11:03:37 -05:00
Tobias Nießen
428701a6d8
sqlite: improve error handling using MaybeLocal
...
As per James' suggestion, consistently use MaybeLocal and avoid Check()
and ToLocalChecked() entirely.
Refs: https://github.com/nodejs/node/pull/54687
PR-URL: https://github.com/nodejs/node/pull/55571
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2024-11-27 11:03:31 -05:00
Tobias Nießen
4e5878536a
sqlite: add readOnly option
...
Allow opening existing SQLite databases with SQLITE_OPEN_READONLY set.
PR-URL: https://github.com/nodejs/node/pull/55567
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
2024-11-27 11:03:27 -05:00
Tobias Nießen
8c35ad12de
sqlite: refactor open options
...
Move options that are only relevant for opening the database into a
self-contained class.
PR-URL: https://github.com/nodejs/node/pull/55442
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2024-11-27 11:03:25 -05:00
Fedor Indutny
c3c403040a
sqlite: cache column names in stmt.all()
...
While the statement is running, it is impossible to modify the column
names and thus it is beneficial to create the host-language (JS) keys
once per all rows and reuse them for all results.
With this change the performance of `.all()` improves by around 25%
depending on the number of columns and rows in the result.
PR-URL: https://github.com/nodejs/node/pull/55373
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2024-11-27 01:23:22 -05:00