oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.04k stars 2.76k forks source link

SQLQueryBindings for arrays using IN operator #13174

Open nicoabie opened 2 months ago

nicoabie commented 2 months ago

What is the problem this feature would solve?

Currently this is the only apparent way to run queries that use IN operator

SELECT d.restrictions FROM diners d WHERE 
-- seems bun does not have a way to do this yet or documentation does not mention it
-- this is dangerous and could be sql injected
d.id IN (${dinerIds})

What is the feature you are proposing to solve the problem?

Accept also Array as binding parameters

What alternatives have you considered?

Tried using TypedArrays and it does not work.

Jarred-Sumner commented 2 months ago

Is this in bun:sqlite?

nicoabie commented 2 months ago

Is this in bun:sqlite?

Yes sir