I want IN operator to work correctly with array params, for example:
SELECT * FROM table WHERE table.id IN ($1)
I would like $1 to be:
$1 = [1, 2, 3, 4] or $1 = ['firstId', 'secondId', 'thridId', '...']
So, it will generate query like SELECT * FROM table WHERE table.id IN (1, 2, 3, 4) where all id from the array are escaped.
Mysql driver handles such parameters very nicely.
also in #527 and #628 and #373 and #777
good
As a workaround you could do the following:
const ids = [1, 2, 3, 4];
const placeholders = ids.map(() => "?").join(",");
db.run(`SELECT * FROM table WHERE table.id IN (${placeholders})`, ids);
Most helpful comment
As a workaround you could do the following: