summaryrefslogtreecommitdiff
path: root/odb/semantics/relational/elements.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-03-28 16:04:48 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-04-10 18:46:44 +0200
commit2aa3cabf1b737e225178230882ee9aadfd817ce0 (patch)
tree85a6c7a90f8483ca11a4bc825cd2ef22114c3d97 /odb/semantics/relational/elements.txx
parente999b1e7295acd8cdb646c2db7db1f5059f10c7d (diff)
Add changelog support for add/drop index/foreign key
Also diagnose changes to primary keys and establish the 'alters' association.
Diffstat (limited to 'odb/semantics/relational/elements.txx')
-rw-r--r--odb/semantics/relational/elements.txx39
1 files changed, 35 insertions, 4 deletions
diff --git a/odb/semantics/relational/elements.txx b/odb/semantics/relational/elements.txx
index e1fd6d5..725fc3f 100644
--- a/odb/semantics/relational/elements.txx
+++ b/odb/semantics/relational/elements.txx
@@ -54,6 +54,23 @@ namespace semantics
//
template <typename N>
+ template <typename T, typename S>
+ T* scope<N>::
+ lookup (name_type const& name)
+ {
+ if (T* r = find<T> (name))
+ return r;
+
+ if (scope* b = base ())
+ {
+ if (find<S> (name) == 0)
+ return b->lookup<T, S> (name);
+ }
+
+ return 0;
+ }
+
+ template <typename N>
template <typename T>
T* scope<N>::
find (name_type const& name)
@@ -106,9 +123,16 @@ namespace semantics
template <typename N>
scope<N>::
- scope (scope const& s, graph& g)
- : first_key_ (names_.end ())
+ scope (scope const& s, scope* base, graph& g)
+ : first_key_ (names_.end ()),
+ first_drop_column_ (names_.end ()),
+ alters_ (0)
{
+ // Set the alters edge for lookup.
+ //
+ if (base != 0)
+ g.new_edge<alters> (*this, *base);
+
for (names_const_iterator i (s.names_begin ());
i != s.names_end (); ++i)
{
@@ -119,9 +143,16 @@ namespace semantics
template <typename N>
scope<N>::
- scope (xml::parser& p, graph& g)
- : first_key_ (names_.end ())
+ scope (xml::parser& p, scope* base, graph& g)
+ : first_key_ (names_.end ()),
+ first_drop_column_ (names_.end ()),
+ alters_ (0)
{
+ // Set the alters edge for lookup.
+ //
+ if (base != 0)
+ g.new_edge<alters> (*this, *base);
+
using namespace xml;
p.content (parser::complex);