diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-04-26 17:18:12 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-04-26 17:18:12 +0200 |
commit | 6692558ba588c76f5e61eb7ed9a1040d36cb9ed7 (patch) | |
tree | 6f7a29e911713829583bc573e938591383f8486c /odb/semantics/relational/primary-key.cxx | |
parent | 84cb9f184bc24ef7151ab9931b46311b03219b14 (diff) |
Add support for extra database info in primary key
Use that to handle Oracle sequence name and SQLite lax auto ids.
Diffstat (limited to 'odb/semantics/relational/primary-key.cxx')
-rw-r--r-- | odb/semantics/relational/primary-key.cxx | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/odb/semantics/relational/primary-key.cxx b/odb/semantics/relational/primary-key.cxx index fdfed0e..a05887f 100644 --- a/odb/semantics/relational/primary-key.cxx +++ b/odb/semantics/relational/primary-key.cxx @@ -12,7 +12,7 @@ namespace semantics { primary_key:: primary_key (primary_key const& k, uscope& s, graph& g) - : key (k, s, g), auto__ (k.auto__) + : key (k, s, g), auto__ (k.auto__), extra_map_ (k.extra_map_) { } @@ -21,6 +21,16 @@ namespace semantics : key (p, s, g), auto__ (p.attribute ("auto", false)) { + // All unhandled attributes go into the extra map. + // + typedef xml::parser::attribute_map_type attr_map; + attr_map const& am (p.attribute_map ()); + + for (attr_map::const_iterator i (am.begin ()); i != am.end (); ++i) + { + if (!i->second.handled) + extra_map_[i->first.name ()] = i->second.value; + } } primary_key& primary_key:: @@ -34,8 +44,14 @@ namespace semantics { s.start_element (xmlns, "primary-key"); key::serialize_attributes (s); + if (auto_ ()) s.attribute ("auto", true); + + for (extra_map::const_iterator i (extra_map_.begin ()); + i != extra_map_.end (); ++i) + s.attribute (i->first, i->second); + key::serialize_content (s); s.end_element (); } |