From 80b868be1e7c249daa714b0c7a5f87694edb8664 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 3 Jul 2015 18:23:51 +0200 Subject: Implement nested id support Now the 'id' specifier can optionally include the data member path to the id inside the composite value. For example: #pragma db id(first) std::pair p; Note that one somewhat counter-intuitive aspect of this new feature is that the whole member marked with id ('p' in the above example) and not just the actual id member ('p.first' in the above example) is treated as readonly. Such nested id also cannot be automatically assigned (auto specifier). --- odb/relational/oracle/source.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'odb/relational/oracle') diff --git a/odb/relational/oracle/source.cxx b/odb/relational/oracle/source.cxx index 310eac6..802bc99 100644 --- a/odb/relational/oracle/source.cxx +++ b/odb/relational/oracle/source.cxx @@ -604,16 +604,16 @@ namespace relational if (p == persist_after_values) { - semantics::data_member* id (id_member (c)); + data_member_path* id (id_member (c)); type* poly_root (polymorphic (c)); bool poly_derived (poly_root != 0 && poly_root != &c); // Top-level auto id. // - if (id != 0 && !poly_derived && id->count ("auto")) + if (id != 0 && !poly_derived && auto_ (*id)) r = "RETURNING " + - convert_from (column_qname (*id, column_prefix ()), *id) + + convert_from (column_qname (*id), *id->back ()) + " INTO " + qp.next (); } -- cgit v1.1