Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiline statements do not work #186

Closed
ValentinKaisermayer opened this issue Nov 6, 2019 · 3 comments
Closed

Multiline statements do not work #186

ValentinKaisermayer opened this issue Nov 6, 2019 · 3 comments

Comments

@ValentinKaisermayer
Copy link

The following example:

using SQLite

sql = "
CREATE TABLE accounts ( 
    account_no INTEGER NOT NULL, 
    balance DECIMAL NOT NULL DEFAULT 0
);
 
CREATE TABLE account_changes (
    change_no INT NOT NULL PRIMARY KEY,
    account_no INTEGER NOT NULL, 
    flag TEXT NOT NULL, 
    amount DECIMAL NOT NULL, 
    changed_at TEXT NOT NULL 
);
"
db = SQLite.DB("test.db")

SQLite.execute!(db, sql)

does not create the correct SQLite db.

@ValentinKaisermayer
Copy link
Author

It seems that execute! only takes one SQL statement at a time.

@quinnj
Copy link
Member

quinnj commented Nov 15, 2019

Currently, we just pass whatever the input string is straight to the sqlite engine. We could potentially split the input string on ; and loop through the results. Maybe we just do that for SQLite.execute! though, since it wouldn't really make sense for SQLite.query.

@quinnj
Copy link
Member

quinnj commented Feb 13, 2020

sqlite doesn't really offer great support for this

@quinnj quinnj closed this as completed Feb 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants