Skip to content

executing a query with multiple create table...; statements does not work #146

@jonasfrey

Description

@jonasfrey
var s_query_create_table1 = `
CREATE TABLE users (
    id int(11) NOT NULL AUTO_INCREMENT,
    name varchar(100) NOT NULL,
    created_at timestamp not null default current_timestamp,
    PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
`
var s_query_create_table2 = `
CREATE TABLE users2 (
    id int(11) NOT NULL AUTO_INCREMENT,
    name varchar(100) NOT NULL,
    created_at timestamp not null default current_timestamp,
    PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
`

// executing the querys one by one works

 result = await client.execute(s_query_create_table1)
 result = await client.execute(s_query_create_table2)
// executing both querys at the same time does not work 

result = await client.execute(`${s_query_create_table1};${s_query_create_table2}`)

the error is:
INFO close connection error: Uncaught (in promise) Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '; CREATE TABLE users2 ( id int(11) NOT NULL AUTO_INCREMENT, name varchar' at line 7 throw new Error(error.message);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions