From 2aa3cabf1b737e225178230882ee9aadfd817ce0 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 28 Mar 2013 16:04:48 +0200 Subject: Add changelog support for add/drop index/foreign key Also diagnose changes to primary keys and establish the 'alters' association. --- odb/semantics/relational/column.cxx | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'odb/semantics/relational/column.cxx') diff --git a/odb/semantics/relational/column.cxx b/odb/semantics/relational/column.cxx index f90b94e..1a47ef7 100644 --- a/odb/semantics/relational/column.cxx +++ b/odb/semantics/relational/column.cxx @@ -104,20 +104,26 @@ namespace semantics // alter_column // alter_column:: - alter_column (alter_column const& ac, uscope&, graph& g) - : unameable (ac, g), - null_altered_ (ac.null_altered_), - null_ (ac.null_) + alter_column (alter_column const& ac, uscope& s, graph& g) + : column (ac, s, g), + alters_ (0), + null_altered_ (ac.null_altered_) { + column* b (s.lookup (ac.name ())); + assert (b != 0); + g.new_edge (*this, *b); } alter_column:: - alter_column (xml::parser& p, uscope&, graph& g) - : unameable (p, g), - null_altered_ (p.attribute_present ("null")), - null_ (null_altered_ ? p.attribute ("null") : false) + alter_column (xml::parser& p, uscope& s, graph& g) + : column (p, s, g), + alters_ (0), + null_altered_ (p.attribute_present ("null")) { - p.content (xml::parser::empty); + name_type n (p.attribute ("name")); + column* b (s.lookup (n)); + assert (b != 0); + g.new_edge (*this, *b); } alter_column& alter_column:: @@ -130,6 +136,9 @@ namespace semantics serialize (xml::serializer& s) const { s.start_element (xmlns, "alter-column"); + + // Here we override the standard column logic. + // unameable::serialize_attributes (s); if (null_altered_) @@ -183,7 +192,7 @@ namespace semantics // { type_info ti (typeid (alter_column)); - ti.add_base (typeid (unameable)); + ti.add_base (typeid (column)); insert (ti); } } -- cgit v1.1