diff options
Diffstat (limited to 'odb/relational/mysql/context.cxx')
-rw-r--r-- | odb/relational/mysql/context.cxx | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/odb/relational/mysql/context.cxx b/odb/relational/mysql/context.cxx index 11b5290..b413b85 100644 --- a/odb/relational/mysql/context.cxx +++ b/odb/relational/mysql/context.cxx @@ -230,6 +230,46 @@ namespace relational return r; } + string context:: + database_type_impl (semantics::type& t, + string const& type, + semantics::context& ctx, + column_type_flags f) + { + string r (base_context::database_type_impl (t, type, ctx, f)); + + if (!r.empty ()) + return r; + + using semantics::enum_; + + if (enum_* e = dynamic_cast<enum_*> (&t)) + { + enum_::enumerates_iterator b (e->enumerates_begin ()), + end (e->enumerates_end ()); + + if (b != end) + { + r += "ENUM ("; + for (enum_::enumerates_iterator i (b); i != end; ++i) + { + if (i != b) + r += ", "; + + r += '\''; + r += i->enumerator ().name (); + r += '\''; + } + r += ")"; + + if ((f & ctf_default_null) == 0) + r += " NOT NULL"; + } + } + + return r; + } + // // SQL type parsing. // |