summaryrefslogtreecommitdiff
path: root/odb/relational/sqlite
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-04-18 18:50:04 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-04-19 08:39:02 +0200
commitb904af7d7a716d243fb73e75b4a1cc404c9455f3 (patch)
tree75bfb4f9773623a50c6dcd4d6bdec53b0efba128 /odb/relational/sqlite
parentcdb791febe6c9ab2cfa36b1a07dfc71548674cf1 (diff)
Implement automatic mapping for C++ enums
Diffstat (limited to 'odb/relational/sqlite')
-rw-r--r--odb/relational/sqlite/context.cxx24
-rw-r--r--odb/relational/sqlite/context.hxx6
2 files changed, 30 insertions, 0 deletions
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<semantics::enum_> ())
+ {
+ r = "INTEGER";
+
+ if ((f & ctf_default_null) == 0)
+ r += " NOT NULL";
+ }
+
+ return r;
+ }
+
//
// SQL type parsing.
//
diff --git a/odb/relational/sqlite/context.hxx b/odb/relational/sqlite/context.hxx
index 1aa18af..621c549 100644
--- a/odb/relational/sqlite/context.hxx
+++ b/odb/relational/sqlite/context.hxx
@@ -47,6 +47,12 @@ namespace relational
virtual bool
grow_impl (semantics::data_member&, semantics::type&, string const&);
+ protected:
+ virtual string
+ database_type_impl (semantics::type&,
+ string const& type,
+ semantics::context&,
+ column_type_flags);
public:
virtual
~context ();