From 0ed744d70ba740735fa455ad78b3c7e3ff287d5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cdigitalist=2Eru=E2=80=9D?= <“strangeqargo@gmail.com”> Date: Mon, 21 Mar 2016 21:48:11 +0300 Subject: [PATCH] readme/ddl2cpp KeyError handling --- scripts/ddl2cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/ddl2cpp b/scripts/ddl2cpp index f558cebf..22635f72 100755 --- a/scripts/ddl2cpp +++ b/scripts/ddl2cpp @@ -127,7 +127,7 @@ types = { 'float': 'floating_point', 'date' : 'day_point', 'datetime' : 'time_point', - 'timestamp' : 'time_point', + #'timestamp' : 'time_point', } @@ -154,6 +154,7 @@ for create in tableCreations: tableTemplateParameters = tableClass print(' namespace ' + tableNamespace, file=header) print(' {', file=header) + DataTypeError = False; for column in create.columns: if column.isConstraint: continue @@ -185,6 +186,7 @@ for create in tableCreations: traitslist = [NAMESPACE + '::' + types[sqlColumnType]]; except KeyError as e: print ('Error: datatype "' + sqlColumnType + '"" is not supported. Implement it (examples: sqlpp11/data_types) or raise an issue on github') + DataTypeError = True requireInsert = True if column.hasAutoValue: traitslist.append(NAMESPACE + '::tag::must_not_insert'); @@ -220,4 +222,6 @@ for create in tableCreations: print('}', file=header) print('#endif', file=header) - +if (DataTypeError): + print("Error: unsupported datatypes." ) + sys.exit(10) #return non-zero error code, we might need it for automation