From 13102d6772ff32f3bcb53479038e979c5bd9a498 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 25 Apr 2012 09:04:35 +0200 Subject: Fix auto id handling in polymorphic objects --- odb/relational/mssql/source.cxx | 5 ++++- odb/relational/oracle/source.cxx | 5 ++++- odb/relational/pgsql/source.cxx | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/odb/relational/mssql/source.cxx b/odb/relational/mssql/source.cxx index af43d12..0816466 100644 --- a/odb/relational/mssql/source.cxx +++ b/odb/relational/mssql/source.cxx @@ -872,7 +872,10 @@ namespace relational { semantics::data_member* id (id_member (c)); - if (id == 0 || !auto_ (*id)) + type* poly_root (polymorphic (c)); + bool poly_derived (poly_root != 0 && poly_root != &c); + + if (id == 0 || poly_derived || !auto_ (*id)) return; // If we are a derived type in a polymorphic hierarchy, then diff --git a/odb/relational/oracle/source.cxx b/odb/relational/oracle/source.cxx index 4ce6e2a..1efe8be 100644 --- a/odb/relational/oracle/source.cxx +++ b/odb/relational/oracle/source.cxx @@ -556,7 +556,10 @@ namespace relational semantics::data_member* id (id_member (c)); - if (id != 0 && id->count ("auto")) + type* poly_root (polymorphic (c)); + bool poly_derived (poly_root != 0 && poly_root != &c); + + if (id != 0 && !poly_derived && id->count ("auto")) { os << endl << strlit (" RETURNING " + diff --git a/odb/relational/pgsql/source.cxx b/odb/relational/pgsql/source.cxx index c868df2..7bb2f8a 100644 --- a/odb/relational/pgsql/source.cxx +++ b/odb/relational/pgsql/source.cxx @@ -611,7 +611,10 @@ namespace relational semantics::data_member* id (id_member (c)); - if (id != 0 && id->count ("auto")) + type* poly_root (polymorphic (c)); + bool poly_derived (poly_root != 0 && poly_root != &c); + + if (id != 0 && !poly_derived && id->count ("auto")) { os << endl << strlit (" RETURNING " + column_qname (*id)); -- cgit v1.1