diff options
Diffstat (limited to 'libodb-qt/odb/qt/basic/mysql/default-mapping.hxx')
-rw-r--r-- | libodb-qt/odb/qt/basic/mysql/default-mapping.hxx | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libodb-qt/odb/qt/basic/mysql/default-mapping.hxx b/libodb-qt/odb/qt/basic/mysql/default-mapping.hxx new file mode 100644 index 0000000..996895f --- /dev/null +++ b/libodb-qt/odb/qt/basic/mysql/default-mapping.hxx @@ -0,0 +1,28 @@ +// file : odb/qt/basic/mysql/default-mapping.hxx +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_QT_BASIC_MYSQL_DEFAULT_MAPPING_HXX +#define ODB_QT_BASIC_MYSQL_DEFAULT_MAPPING_HXX + +#include <QtCore/QString> +#include <QtCore/QByteArray> +#include <QtCore/QUuid> + +// Map QString to MySQL TEXT for non-id and to VARCHAR(128) for id members. +// MySQL cannot have primary key of the TEXT type. Allow NULL values by +// default as QString provides a null representation. +// +#pragma db value(QString) type("TEXT") id_type("VARCHAR(128)") null + +// Map QByteArray to MySQL BLOB by default. Allow NULL values by default as +// QByteArray provides a null representation. +// +#pragma db value(QByteArray) type("BLOB") null + +// By default map QUuid to MySQL BINARY(16) and use NULL to represent null +// UUIDs. If NULL is disabled (e.g., at the member level), then we store +// the null UUID (i.e., all bytes are zero). +// +#pragma db value(QUuid) type("BINARY(16)") null + +#endif // ODB_QT_BASIC_MYSQL_DEFAULT_MAPPING_HXX |