You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry for bothering you guys. I'm trying to delete multiple records using the IN operator but it's not working.
Example:
constSqlite=require("better-sqlite3");constdb=newSqlite(":memory:");db.exec(`create table if not exists categories( id integer primary key, name text not null, parentId integer default null references categories(id) on update cascade on delete restrict);insert into categories (name) values ('A'), ('B'), ('C');`);constfindAll=db.prepare(`select * from categories;`);console.log(findAll.all());conststmt=db.prepare(`delete from categories where id in ($ids);`);constids=[1,2,3].join(", ");console.log(stmt.run({ ids }));console.log(findAll.all());
Does better-sqlite3 not support parameterized IN operator? If it doesn't than should I delete records one by one inside a transaction?
Thanks in advance 💝
The text was updated successfully, but these errors were encountered:
Sorry for bothering you guys. I'm trying to delete multiple records using the
IN
operator but it's not working.Example:
Does
better-sqlite3
not support parameterized IN operator? If it doesn't than should I delete records one by one inside a transaction?Thanks in advance 💝
The text was updated successfully, but these errors were encountered: