diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-02-05 15:50:07 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-02-05 15:50:07 +0200 |
commit | 5b27e12cc00c3faf4f8171d4f41a0ec5d155db48 (patch) | |
tree | 69c46d3fc0380d1681283c87bd90227e6e1138ae /odb/relational/pgsql/header.cxx | |
parent | 07299aa3a0a840845c5d22b74af30aa0ce3ac9f1 (diff) |
Add support for change-tracking containers
ODB now supports "smart" ordered containers. Such containers get extra
functions for updating and deleting individual elements. Based on this
functionality implement two change-tracking containers: odb::vector
(equivalent to std::vector) and QOdbList (equivalent to QList). New
tests: common/container/change-tracking and qt/common/container/change-
tracking.
Diffstat (limited to 'odb/relational/pgsql/header.cxx')
-rw-r--r-- | odb/relational/pgsql/header.cxx | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/odb/relational/pgsql/header.cxx b/odb/relational/pgsql/header.cxx index 5141c6c..ef0f018 100644 --- a/odb/relational/pgsql/header.cxx +++ b/odb/relational/pgsql/header.cxx @@ -103,24 +103,36 @@ namespace relational container_traits (base const& x): base (x) {} virtual void - container_public_extra_pre (semantics::data_member&) + container_public_extra_pre (semantics::data_member& m, + semantics::type& t) { if (!object (c_) || (abstract (c_) && !polymorphic (c_))) return; + bool smart (!inverse (m, "value") && !unordered (m) && + container_smart (t)); + // Container statement names. // - os << "static const char select_all_name[];" - << "static const char insert_one_name[];" - << "static const char delete_all_name[];" + os << "static const char select_name[];" + << "static const char insert_name[];"; + + if (smart) + os << "static const char update_name[];"; + + os << "static const char delete_name[];" << endl; // Container statement types. // - os << "static const unsigned int select_all_types[];" - << "static const unsigned int insert_one_types[];" - << "static const unsigned int delete_all_types[];" - << endl; + os << "static const unsigned int select_types[];" + << "static const unsigned int insert_types[];"; + + if (smart) + os << "static const unsigned int update_types[];" + << "static const unsigned int delete_types[];"; + + os << endl; } }; entry<container_traits> container_traits_; |