duckdb-wasm icon indicating copy to clipboard operation
duckdb-wasm copied to clipboard

Support array arguments in prepared statements

Open domoritz opened this issue 4 years ago • 5 comments

See https://github.com/duckdb/duckdb-wasm/issues/441#issuecomment-986913723

domoritz avatar Dec 06 '21 16:12 domoritz

Right now, we just JSON.stringify the arguments here:

https://github.com/duckdb/duckdb-wasm/blob/ffa9210415e394fa84f0c769a54ef86b169bc2ab/packages/duckdb-wasm/src/bindings/bindings_base.ts#L197-L210

and then unpack them here:

https://github.com/duckdb/duckdb-wasm/blob/ffa9210415e394fa84f0c769a54ef86b169bc2ab/lib/src/webdb.cc#L219-L242

We probably just need to extend rapidjson::Document -> std::vector<duckdb::Value>.

ankoh avatar Dec 07 '21 08:12 ankoh

any movement here? would love to use this

scamden avatar Sep 08 '23 21:09 scamden

in my case i hacked around this by doing:

const bindingIndexes = rowIds.map((_, i) => `?`).join(',');

...
   `SELECT * FROM table WHERE row_id in (${bindingIndexes})`,
              { bindings: rowIds }

but a little tedious and would be especially tricky if i had any other bindings

scamden avatar Sep 11 '23 21:09 scamden

Apologies for bumping, but I would also love to see this fixed — we are now using DuckDB-Wasm for SQL code cells in Observable Framework.

mbostock avatar Mar 07 '24 22:03 mbostock