diff --git a/scripts/ddl2cpp b/scripts/ddl2cpp index 503721f6e..bc47ecc5b 100755 --- a/scripts/ddl2cpp +++ b/scripts/ddl2cpp @@ -254,8 +254,12 @@ ddlConstraint = pp.Group( ddlIfNotExists = pp.Group( pp.CaselessLiteral("IF") + pp.CaselessLiteral("NOT") + pp.CaselessLiteral("EXISTS") ).setResultsName("ifNotExists") +ddlOrReplace = pp.Group( + pp.CaselessLiteral("OR") + pp.CaselessLiteral("REPLACE") +).setResultsName("orReplace") ddlCreateTable = pp.Group( pp.CaselessLiteral("CREATE") + + pp.Suppress(pp.Optional(ddlOrReplace)) + pp.CaselessLiteral("TABLE") + pp.Suppress(pp.Optional(ddlIfNotExists)) + ddlName.setResultsName("tableName") diff --git a/tests/scripts/ddl2cpp_sample_good.sql b/tests/scripts/ddl2cpp_sample_good.sql index cf96ca2ee..8eeda9237 100644 --- a/tests/scripts/ddl2cpp_sample_good.sql +++ b/tests/scripts/ddl2cpp_sample_good.sql @@ -33,7 +33,7 @@ CREATE TABLE tab_foo CONSTRAINT uc_delta UNIQUE (delta, _epsilon) ); -CREATE TABLE tab_bar +CREATE OR REPLACE TABLE tab_bar ( alpha bigint AUTO_INCREMENT RRIMARY_KEY, beta varchar(255) NULL DEFAULT "",