diff --git a/README.md b/README.md index a7c8f53c..03f6fc3f 100644 --- a/README.md +++ b/README.md @@ -138,11 +138,22 @@ Basic usage: __Linux install:__ git clone date library, needed connectors, cmake and make install them. -create DDL files (like mysql: 'show create table MyDatabase.MyTable'), create headers for them with provided python script: + +__Create DDL files__: +``` +mysql: 'show create table MyDatabase.MyTable' +mysqldump --no-data MyDatabase > MyDatabase.sql ca + +``` +Create headers for them with provided python script: ``` %sqlpp11_dir%/scripts/ddl2cpp ~/temp/MyTable.ddl ~/temp/MyTable %DatabaseNamespaceForExample% ``` -include generated header (MyTable.h), that's all +(In case you're getting notes about unsupported column type take a look at the other datatypes in sqlpp11/data_types. They are not hard to implement.) + +Include generated header (MyTable.h), that's all + + License: diff --git a/scripts/ddl2cpp b/scripts/ddl2cpp index 2b422078..f558cebf 100755 --- a/scripts/ddl2cpp +++ b/scripts/ddl2cpp @@ -181,7 +181,10 @@ for create in tableCreations: print(' const T& operator()() const { return ' + columnMember + '; }', file=header) print(' };', file=header) print(' };', file=header) - traitslist = [NAMESPACE + '::' + types[sqlColumnType]]; + try: + 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') requireInsert = True if column.hasAutoValue: traitslist.append(NAMESPACE + '::tag::must_not_insert');