diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-08-22 10:47:30 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-08-22 10:47:30 +0200 |
commit | 3e57c662b42831555498607d607c349f30c5b7de (patch) | |
tree | 932a91ef684789c783485c9e5e5c829a87607763 /odb/relational | |
parent | a94dde17a2e6a41c36dd052bc8d2bbbc224aeb97 (diff) |
Enable foreign key constraints checking in SQLite
Due to bugs in SQLite DDL foreign key support, we have to temporarily
disable foreign keys when re-creating the schema. New manual section:
12.5.3, "Foreign Key Constraints".
Diffstat (limited to 'odb/relational')
-rw-r--r-- | odb/relational/sqlite/schema.cxx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/odb/relational/sqlite/schema.cxx b/odb/relational/sqlite/schema.cxx index 253772d..77a9590 100644 --- a/odb/relational/sqlite/schema.cxx +++ b/odb/relational/sqlite/schema.cxx @@ -19,6 +19,7 @@ namespace relational // // Create. // + struct object_columns: relational::object_columns, context { object_columns (base const& x): base (x) {} @@ -61,6 +62,21 @@ namespace relational } } + virtual void + reference (semantics::data_member& m) + { + // In SQLite, by default, constraints are immediate. + // + if (semantics::class_* c = object_pointer (member_type (m, prefix_))) + { + os << " REFERENCES " << table_qname (*c) << " (" << + column_qname (*id_member (*c)) << ") " << + "DEFERRABLE INITIALLY DEFERRED"; + } + else + base::reference (m); + } + }; entry<object_columns> object_columns_; } |