WiseLibs / better-sqlite3

The fastest and simplest library for SQLite3 in Node.js.
MIT License
5.44k stars 395 forks source link

Q: How to properly use the IN statement with arbitrary number of arguments? #1081

Closed rayzorben closed 12 months ago

rayzorben commented 12 months ago

I could be doing something wrong, but I am doing

var foo = data.prepare "SELECT * FROM MyTable WHERE Name IN (?)";
foo.all("'Name1','Name2','Name3'");

I am not getting anything back despite the query working in SqliteStudio and I am guessing it has to do with only one bind parameter being '?'.

Is there an easy way to support this, or do I just need to exec() ?

Prinzhorn commented 12 months ago

https://github.com/WiseLibs/better-sqlite3/issues/948#issuecomment-1407653239