From b904af7d7a716d243fb73e75b4a1cc404c9455f3 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 18 Apr 2011 18:50:04 +0200 Subject: Implement automatic mapping for C++ enums --- odb/relational/sqlite/context.cxx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'odb/relational/sqlite/context.cxx') diff --git a/odb/relational/sqlite/context.cxx b/odb/relational/sqlite/context.cxx index 7803298..b2b3033 100644 --- a/odb/relational/sqlite/context.cxx +++ b/odb/relational/sqlite/context.cxx @@ -196,6 +196,30 @@ 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 (t.is_a ()) + { + r = "INTEGER"; + + if ((f & ctf_default_null) == 0) + r += " NOT NULL"; + } + + return r; + } + // // SQL type parsing. // -- cgit v1.1