diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-11-17 18:05:06 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-11-17 18:05:06 +0200 |
commit | 2fe7a723c0b98d23531a76d9c1a451e3a57bf0c5 (patch) | |
tree | 8bd0323a9114a405902b3dfc116f97307278ae2b /odb/mysql/context.cxx | |
parent | 302b804ec633889f26dc54d937d9becc09246152 (diff) |
Add support for unidirectional object relationships
New test: common/relationship.
Diffstat (limited to 'odb/mysql/context.cxx')
-rw-r--r-- | odb/mysql/context.cxx | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/odb/mysql/context.cxx b/odb/mysql/context.cxx index 4803da2..de3eed0 100644 --- a/odb/mysql/context.cxx +++ b/odb/mysql/context.cxx @@ -26,28 +26,28 @@ namespace mysql type_map_entry type_map[] = { - {"bool", "TINYINT(1) NOT NULL", 0}, + {"bool", "TINYINT(1)", 0}, - {"char", "TINYINT NOT NULL", 0}, - {"signed char", "TINYINT NOT NULL", 0}, - {"unsigned char", "TINYINT UNSIGNED NOT NULL", 0}, + {"char", "TINYINT", 0}, + {"signed char", "TINYINT", 0}, + {"unsigned char", "TINYINT UNSIGNED", 0}, - {"short int", "SMALLINT NOT NULL", 0}, - {"short unsigned int", "SMALLINT UNSIGNED NOT NULL", 0}, + {"short int", "SMALLINT", 0}, + {"short unsigned int", "SMALLINT UNSIGNED", 0}, - {"int", "INT NOT NULL", 0}, - {"unsigned int", "INT UNSIGNED NOT NULL", 0}, + {"int", "INT", 0}, + {"unsigned int", "INT UNSIGNED", 0}, - {"long int", "BIGINT NOT NULL", 0}, - {"long unsigned int", "BIGINT UNSIGNED NOT NULL", 0}, + {"long int", "BIGINT", 0}, + {"long unsigned int", "BIGINT UNSIGNED", 0}, - {"long long int", "BIGINT NOT NULL", 0}, - {"long long unsigned int", "BIGINT UNSIGNED NOT NULL", 0}, + {"long long int", "BIGINT", 0}, + {"long long unsigned int", "BIGINT UNSIGNED", 0}, - {"float", "FLOAT NOT NULL", 0}, - {"double", "DOUBLE NOT NULL", 0}, + {"float", "FLOAT", 0}, + {"double", "DOUBLE", 0}, - {"::std::string", "TEXT NOT NULL", "VARCHAR(255) NOT NULL"} + {"::std::string", "TEXT", "VARCHAR (255)"} }; } @@ -145,8 +145,10 @@ namespace mysql virtual void traverse_composite (member_info& mi) { + // Reset any overrides. + // if (!hg_.r_) - hg_.r_ = hg_.dispatch (dynamic_cast<semantics::class_&> (mi.t)); + hg_.r_ = context::grow (dynamic_cast<semantics::class_&> (mi.t)); } virtual void @@ -216,11 +218,12 @@ namespace mysql string context::data:: column_type_impl (semantics::type& t, string const& type, - semantics::context* ctx) const + semantics::context& ctx, + column_type_flags f) const { - string r (::context::data::column_type_impl (t, type, ctx)); + string r (::context::data::column_type_impl (t, type, ctx, f)); - if (!r.empty () && ctx != 0 && ctx->count ("auto")) + if (!r.empty () && ctx.count ("auto") && (f & ctf_object_id_ref) == 0) r += " AUTO_INCREMENT"; return r; |