0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-16 04:47:18 +08:00

readme/ddl2cpp KeyError handling

This commit is contained in:
“digitalist.ru” 2016-03-21 21:48:11 +03:00
parent b7b651e98b
commit 0ed744d70b

View File

@ -127,7 +127,7 @@ types = {
'float': 'floating_point', 'float': 'floating_point',
'date' : 'day_point', 'date' : 'day_point',
'datetime' : 'time_point', 'datetime' : 'time_point',
'timestamp' : 'time_point', #'timestamp' : 'time_point',
} }
@ -154,6 +154,7 @@ for create in tableCreations:
tableTemplateParameters = tableClass tableTemplateParameters = tableClass
print(' namespace ' + tableNamespace, file=header) print(' namespace ' + tableNamespace, file=header)
print(' {', file=header) print(' {', file=header)
DataTypeError = False;
for column in create.columns: for column in create.columns:
if column.isConstraint: if column.isConstraint:
continue continue
@ -185,6 +186,7 @@ for create in tableCreations:
traitslist = [NAMESPACE + '::' + types[sqlColumnType]]; traitslist = [NAMESPACE + '::' + types[sqlColumnType]];
except KeyError as e: except KeyError as e:
print ('Error: datatype "' + sqlColumnType + '"" is not supported. Implement it (examples: sqlpp11/data_types) or raise an issue on github') print ('Error: datatype "' + sqlColumnType + '"" is not supported. Implement it (examples: sqlpp11/data_types) or raise an issue on github')
DataTypeError = True
requireInsert = True requireInsert = True
if column.hasAutoValue: if column.hasAutoValue:
traitslist.append(NAMESPACE + '::tag::must_not_insert'); traitslist.append(NAMESPACE + '::tag::must_not_insert');
@ -220,4 +222,6 @@ for create in tableCreations:
print('}', file=header) print('}', file=header)
print('#endif', 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