From b2f0cd834b8f5651985357f8acbe82edd7d11c63 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 11 Oct 2011 16:52:45 +0200 Subject: Split 'in' binding into insert/update pair; rename 'out' to select Also add the initial infrastructure for the readonly members support. Right now the split insert/update bindings allows us to avoid sending object id in UPDATE statements. It will also allows us to support readonly members. --- odb/context.hxx | 47 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 14 deletions(-) (limited to 'odb/context.hxx') diff --git a/odb/context.hxx b/odb/context.hxx index f91568a..ffafb43 100644 --- a/odb/context.hxx +++ b/odb/context.hxx @@ -216,7 +216,7 @@ public: upcase (string const&); public: - semantics::type& + static semantics::type& member_type (semantics::data_member& m, string const& key_prefix); // Predicates. @@ -234,12 +234,6 @@ public: return t.count ("view"); } - static bool - transient (semantics::data_member& m) - { - return m.count ("transient"); - } - // Check whether the type is a wrapper. Return the wrapped type if // it is a wrapper and NULL otherwise. // @@ -322,6 +316,24 @@ public: return c.abstract () || c.count ("abstract"); } + static bool + transient (semantics::data_member& m) + { + return m.count ("transient"); + } + + static bool + id (semantics::data_member& m) + { + return m.count ("id"); + } + + bool + readonly (semantics::data_member& m) + { + return m.count ("readonly"); + } + bool null (semantics::data_member&); @@ -412,11 +424,18 @@ public: // Counts and other information. // public: - static size_t - in_column_count (semantics::class_&); + struct column_count_type + { + column_count_type (): total (0), id (0), inverse (0), readonly (0) {} + + size_t total; + size_t id; + size_t inverse; + size_t readonly; + }; - static size_t - out_column_count (semantics::class_&); + static column_count_type + column_count (semantics::class_&); static semantics::data_member* id_member (semantics::class_& c) @@ -480,9 +499,9 @@ public: } static semantics::type& - container_idt (semantics::type& c) + container_idt (semantics::data_member& m) { - return *c.get ("id-tree-type"); + return member_type (m, "id"); } static semantics::type& @@ -578,7 +597,7 @@ private: composite_ (semantics::class_&); template - X + static X indirect_value (semantics::context const& c, string const& key) { typedef X (*func) (); -- cgit v1.1