Skip to content

No support for multiple commands in run #1121

@infodusha

Description

@infodusha

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

Activity

MartinLoeper

MartinLoeper commented on May 1, 2022

@MartinLoeper

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

RubenNL

RubenNL commented on Jun 23, 2022

@RubenNL

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

itsPG

itsPG commented on Dec 5, 2023

@itsPG

Spent much time struggling with this.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @daniellockyer@itsPG@MartinLoeper@infodusha@RubenNL

        Issue actions

          No support for multiple commands in run · Issue #1121 · TryGhost/node-sqlite3