diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-03-21 08:36:21 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-04-23 16:50:56 +0200 |
commit | 8d89bf37dd4ef3cb7373e1841ff57a53916fff0d (patch) | |
tree | 704b7de0338eba0e008a96a09b6d57e86846d1b1 /odb/relational/mssql/header.cxx | |
parent | 68ff21c56fb287790440208907ad2a851a108f89 (diff) |
Polymorphic inheritance support
Diffstat (limited to 'odb/relational/mssql/header.cxx')
-rw-r--r-- | odb/relational/mssql/header.cxx | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/odb/relational/mssql/header.cxx b/odb/relational/mssql/header.cxx index 08ef306..957f880 100644 --- a/odb/relational/mssql/header.cxx +++ b/odb/relational/mssql/header.cxx @@ -22,24 +22,31 @@ namespace relational virtual void image_extra (type& c) { - if (!(composite (c) || abstract (c))) + if (!(composite (c) || (abstract (c) && !polymorphic (c)))) { - bool gc (options.generate_query ()); + type* poly_root (polymorphic (c)); - if (gc) - os << "mssql::change_callback change_callback_;" - << endl; + // If this is a polymorphic type, only add callback to the root. + // + if (poly_root == 0 || poly_root == &c) + { + bool gc (options.generate_query ()); - os << "mssql::change_callback*" << endl - << "change_callback ()" - << "{"; + if (gc) + os << "mssql::change_callback change_callback_;" + << endl; - if (gc) - os << "return &change_callback_;"; - else - os << "return 0;"; + os << "mssql::change_callback*" << endl + << "change_callback ()" + << "{"; - os << "}"; + if (gc) + os << "return &change_callback_;"; + else + os << "return 0;"; + + os << "}"; + } } } }; |