aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-04-25 09:04:35 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-04-25 09:04:35 +0200
commit13102d6772ff32f3bcb53479038e979c5bd9a498 (patch)
tree92f3ceb9ea689072e518d41b6e712852e5f51966
parent8d89bf37dd4ef3cb7373e1841ff57a53916fff0d (diff)
Fix auto id handling in polymorphic objects
-rw-r--r--odb/relational/mssql/source.cxx5
-rw-r--r--odb/relational/oracle/source.cxx5
-rw-r--r--odb/relational/pgsql/source.cxx5
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));