diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-04-06 18:15:50 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-04-06 18:15:50 +0200 |
commit | 6a66f46d4b416ce3408f8d938032d8b95265b1bb (patch) | |
tree | dd65f790e2e07087df06ec374ecefc7bc33fd42e /odb | |
parent | fc65c4e978759fa10fc61341d98d4dccac42a53f (diff) |
Map string keys to MySQL VARCHAR(128) instead of 255 to support 4-byte UTF-8
This is a backwards-incompatible change in that it may change your schema.
To obtain the old behavior you will have to explicitly re-map std::string
with the id_type pragma or explicitly specify the database type for each
affected id member with the type pragma.
Diffstat (limited to 'odb')
-rw-r--r-- | odb/relational/mysql/context.cxx | 2 | ||||
-rw-r--r-- | odb/relational/mysql/schema.cxx | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/odb/relational/mysql/context.cxx b/odb/relational/mysql/context.cxx index cf75b12..3893c16 100644 --- a/odb/relational/mysql/context.cxx +++ b/odb/relational/mysql/context.cxx @@ -50,7 +50,7 @@ namespace relational {"float", "FLOAT", 0, false}, {"double", "DOUBLE", 0, false}, - {"::std::string", "TEXT", "VARCHAR(255)", false}, + {"::std::string", "TEXT", "VARCHAR(128)", false}, {"::size_t", "BIGINT UNSIGNED", 0, false}, {"::std::size_t", "BIGINT UNSIGNED", 0, false} diff --git a/odb/relational/mysql/schema.cxx b/odb/relational/mysql/schema.cxx index 5b1ad26..fe29d03 100644 --- a/odb/relational/mysql/schema.cxx +++ b/odb/relational/mysql/schema.cxx @@ -461,7 +461,7 @@ namespace relational pre_statement (); os << "CREATE TABLE IF NOT EXISTS " << qt_ << " (" << endl - << " " << qn_ << " VARCHAR(255) NOT NULL PRIMARY KEY," << endl + << " " << qn_ << " VARCHAR(128) NOT NULL PRIMARY KEY," << endl << " " << qv_ << " BIGINT UNSIGNED NOT NULL," << endl << " " << qm_ << " TINYINT(1) NOT NULL)" << endl; |