diff --git a/scripts/ddl2cpp b/scripts/ddl2cpp index b7d5c1df..e0b580fe 100755 --- a/scripts/ddl2cpp +++ b/scripts/ddl2cpp @@ -259,7 +259,7 @@ ddlCreateTable = pp.Group( + pp.Suppress(pp.Optional(ddlIfNotExists)) + ddlName.setResultsName("tableName") + ddlLeft - + pp.Group(pp.delimitedList(ddlColumn | pp.Suppress(ddlConstraint))).setResultsName( + + pp.Group(pp.delimitedList(pp.Suppress(ddlConstraint) | ddlColumn)).setResultsName( "columns" ) + ddlRight diff --git a/tests/scripts/ddl2cpp_sample_good.sql b/tests/scripts/ddl2cpp_sample_good.sql index b478567c..ac6b048c 100644 --- a/tests/scripts/ddl2cpp_sample_good.sql +++ b/tests/scripts/ddl2cpp_sample_good.sql @@ -28,12 +28,13 @@ CREATE TABLE tab_foo ( delta varchar(255), _epsilon bigint, - `omega` double + `omega` double, + CONSTRAINT uc_delta UNIQUE (delta, _epsilon) ); CREATE TABLE tab_bar ( - alpha bigint AUTO_INCREMENT, + alpha bigint AUTO_INCREMENT RRIMARY_KEY, beta varchar(255) NULL DEFAULT "", gamma bool NOT NULL, delta int