planetarydev/json-sql-builder2

$ine broken for $createView

lukesrw opened this issue · 2 comments

This JSON:

{
    "$select": {
        "$column1": true,
        "$from": "tbl1"
    },
    "$view": "view1",
    "$ine": true
}

Produces the following SQL:

CREATE VIEW  IF NOT EXISTSview1 AS SELECT column1 FROM tbl1

Maybe try $ifNotExists helper instead of $ine. Hope this will work.

$ifNotExists does not work with SQLite, unfortunately until this is fixed I am using a workaround:

sql = sql.replace(
    "CREATE VIEW IF NOT EXISTS",
    "CREATE VIEW IF NOT EXISTS "
);