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

use different sql command separator #27

Closed
wants to merge 2 commits into from
Closed

Conversation

masgari
Copy link

@masgari masgari commented Mar 10, 2019

Current separator ; causes problem when using BEGIN TRANSACTION or CREATE TRIGGER, example (using sqlite3):

_boot {
    exec = <<SQL

        CREATE TABLE IF NOT EXISTS "Bucket" (
            "name" VARCHAR(255) NOT NULL PRIMARY KEY,
            "dir" VARCHAR(255) UNIQUE NOT NULL,
            "createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP
        );
        CREATE TRIGGER IF NOT EXISTS "trig1" 
        BEFORE INSERT ON "Bucket"
        BEGIN
            SELECT RAISE(ABORT, 'Dir can not be /dev') WHERE NEW.dir like '/dev%';
        END;
   SQL
}

It generates sql commands like these:

CREATE TRIGGER IF NOT EXISTS "trig1" 
        BEFORE INSERT ON "Bucket"
        BEGIN
            SELECT RAISE(ABORT, 'Dir can not be /dev') WHERE NEW.dir like '/dev%';

and

END;

@alash3al
Copy link
Owner

alash3al commented Mar 10, 2019

but -- will make some conflicts if you have some comments, let's think in another separator

@masgari
Copy link
Author

masgari commented Mar 10, 2019

agreed, something like --//-- might be better as it can't cause problem in other editors too

@alash3al
Copy link
Owner

I think it will be better if that separator become an option in the cli flags

@masgari masgari closed this Mar 11, 2019
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

Successfully merging this pull request may close these issues.

2 participants