node-sqlite3 icon indicating copy to clipboard operation
node-sqlite3 copied to clipboard

No support for multiple commands in run

Open infodusha opened this issue 6 years ago • 3 comments

I tried to add tables for two days. The query was:

db.run(`
    PRAGMA foreign_keys = ON;
    CREATE TABLE pkgs( .... );
    CREATE TABLE subs( ... );
`);

And this query do nothing. Wow! The bug is only first command runs! Solution? Yey, just change db.run to db.exec. Please, fix multiple commands in run or tell about this on wiki docs. sqlite3 version: 4.0.6 node version: 11.7.0

infodusha avatar Feb 08 '19 16:02 infodusha

Just stumbled across this. Is it true that .run() and .get() only execute the first sql command/query in the given string argument?

MartinLoeper avatar May 01 '22 23:05 MartinLoeper

Spent some time searching just to find this. This really needs to be added to the docs.

RubenNL avatar Jun 23 '22 12:06 RubenNL

Spent much time struggling with this.

Another thing you might want to know: .exec doesn't accept any param.

itsPG avatar Dec 05 '23 09:12 itsPG