node:sqlite to support retrieving rows as arrays instead of objects #57534
Labels
feature request
Issues that request new features to be added to Node.js.
sqlite
Issues and PRs related to the SQLite subsystem.
What is the problem this feature will solve?
Currently node:sqlite Session.* methods retrieve rows only as objects. In the application we write columns are auto-generated, their names are inherently meaningless, and their retrieval as an object would result in node_sqlite wasting CPU cycles to construct the object, and then I would have to run through reverse lookup loop over the keys of that unnecessarily constructed object to reproduce the original array of values as specified in the
SELECT <expression1>, <expression2>, ... <expressionN>
sequence.In other words,
SELECT <expression1> AS c0, <expression2> AS c1, ... <expressionN> AS cN
{ c0: <val>, c1: <val>, ..., cN: <val>}
[c0, c1, ..., cN]
to arrive at[val0, val1, ..., valN]
.I'd like to request support of array row retrieval, just like it's already supported by all other sqlite APIs (like better-sqlite3, native WASM sqlite api-oo1, etc).
Object retrieval is unnecessary wasteful and impractical, especially when the number of retrieved columns (expressions) is measured in hundreds and their names are inherently meaningless.
What is the feature you are proposing to solve the problem?
Either add a parameter to request an array per row instead of object per row, or add additional methods that achieve this.
Other libraries tend to pass this in as a parameter.
What alternatives have you considered?
better-sqlite3, sqlite WASM api-oo1, even python libraries support this.
The text was updated successfully, but these errors were encountered: