diff options
author | Constantin Michael <constantin@codesynthesis.com> | 2011-07-05 12:45:15 +0200 |
---|---|---|
committer | Constantin Michael <constantin@codesynthesis.com> | 2011-07-05 14:43:38 +0200 |
commit | 87abcad59a90a9a9ce8809cdf51bea7fc5901baf (patch) | |
tree | 86750f103a3539b7a6f33bdcdc21ee634e3d44f3 | |
parent | 98bfe6e9473e16cc10186dc0b58c88316e54ccb0 (diff) |
Add enum support to PostgreSQL
-rw-r--r-- | odb/relational/pgsql/context.cxx | 24 | ||||
-rw-r--r-- | odb/relational/pgsql/context.hxx | 5 |
2 files changed, 25 insertions, 4 deletions
diff --git a/odb/relational/pgsql/context.cxx b/odb/relational/pgsql/context.cxx index ea18d1f..082800d 100644 --- a/odb/relational/pgsql/context.cxx +++ b/odb/relational/pgsql/context.cxx @@ -210,6 +210,30 @@ namespace relational return r; } + string context:: + database_type_impl (semantics::type& t, + semantics::names* hint, + semantics::context& ctx, + column_type_flags f) + { + string r (base_context::database_type_impl (t, hint, ctx, f)); + + if (!r.empty ()) + return r; + + using semantics::enum_; + + if (t.is_a<semantics::enum_> ()) + { + r = "INTEGER"; + + if ((f & ctf_default_null) == 0) + r += " NOT NULL"; + } + + return r; + } + // // SQL type parsing. // diff --git a/odb/relational/pgsql/context.hxx b/odb/relational/pgsql/context.hxx index 3190bb3..66d9318 100644 --- a/odb/relational/pgsql/context.hxx +++ b/odb/relational/pgsql/context.hxx @@ -88,10 +88,7 @@ namespace relational database_type_impl (semantics::type& t, semantics::names* hint, semantics::context& ctx, - column_type_flags f) - { - return base_context::database_type_impl (t, hint, ctx, f); - } + column_type_flags f); public: virtual |