summaryrefslogtreecommitdiff
path: root/odb/context.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-10-11 16:52:45 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-10-21 19:25:06 +0200
commitb2f0cd834b8f5651985357f8acbe82edd7d11c63 (patch)
tree591f652e2f49631a0920828598eba4fff28fcfc8 /odb/context.hxx
parent5ff1382aeae38946889b1e09a21bde1c48475dfd (diff)
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.
Diffstat (limited to 'odb/context.hxx')
-rw-r--r--odb/context.hxx47
1 files changed, 33 insertions, 14 deletions
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<semantics::type*> ("id-tree-type");
+ return member_type (m, "id");
}
static semantics::type&
@@ -578,7 +597,7 @@ private:
composite_ (semantics::class_&);
template <typename X>
- X
+ static X
indirect_value (semantics::context const& c, string const& key)
{
typedef X (*func) ();