Consider adding support for "IN" statements in prepared queries
teleclimber opened this issue · 1 comments
teleclimber commented
Go's sqlx has a nice helper for preparing queries with "IN" statements:
http://jmoiron.github.io/sqlx/#inQueries
This allows you to write queries like this:
db.queryEntries(`SELECT * FROM things WHERE color IN (:colors)`, {colors:["blue","yellow"]});
I looked at the code to see if I could do this but with the WASM stuff in there I quickly lost the thread.
dyedgreen commented
I don't think this can be supported reasonably at the level of this library.
SQLite does not have a concept of binding arrays of values, rather the IN
works with an in-line literal list of values, or an existing table / nested SELECT
statement. (See https://www.sqlite.org/syntax/expr.html.)
This could be implemented e.g. at the level of a query builder.