summaryrefslogtreecommitdiff
path: root/odb/relational/sqlite/schema.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/relational/sqlite/schema.cxx')
-rw-r--r--odb/relational/sqlite/schema.cxx26
1 files changed, 25 insertions, 1 deletions
diff --git a/odb/relational/sqlite/schema.cxx b/odb/relational/sqlite/schema.cxx
index 195a71e..253772d 100644
--- a/odb/relational/sqlite/schema.cxx
+++ b/odb/relational/sqlite/schema.cxx
@@ -19,11 +19,35 @@ namespace relational
//
// Create.
//
- struct object_columns: relational::object_columns
+ struct object_columns: relational::object_columns, context
{
object_columns (base const& x): base (x) {}
virtual void
+ default_enum (semantics::data_member& m, tree en, string const&)
+ {
+ // Make sure the column is mapped to INTEGER.
+ //
+ if (column_sql_type (m).type != sql_type::INTEGER)
+ {
+ cerr << m.file () << ":" << m.line () << ":" << m.column ()
+ << ": error: column with default value specified as C++ "
+ << "enumerator must map to SQLite INTEGER" << endl;
+
+ throw generation_failed ();
+ }
+
+ using semantics::enumerator;
+
+ enumerator& e (dynamic_cast<enumerator&> (*unit.find (en)));
+
+ if (e.enum_ ().unsigned_ ())
+ os << " DEFAULT " << e.value ();
+ else
+ os << " DEFAULT " << static_cast<long long> (e.value ());
+ }
+
+ virtual void
constraints (semantics::data_member& m)
{
base::constraints (m);