aboutsummaryrefslogtreecommitdiff
path: root/odb/sqlite/result.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-04-25 09:46:59 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-04-25 09:46:59 +0200
commitc4d059b6346398e936dbc8c84d35c90aa4ec4253 (patch)
tree8853f330b772bb720b55ad51dda0b71f3dcf5319 /odb/sqlite/result.txx
parent177658c41d9949f7f327a714210835967a2e9d3e (diff)
Pass id binding instead of id image in container traits
This will allow us to reuse things more.
Diffstat (limited to 'odb/sqlite/result.txx')
-rw-r--r--odb/sqlite/result.txx18
1 files changed, 14 insertions, 4 deletions
diff --git a/odb/sqlite/result.txx b/odb/sqlite/result.txx
index 83dd4b0..daf4d39 100644
--- a/odb/sqlite/result.txx
+++ b/odb/sqlite/result.txx
@@ -37,13 +37,23 @@ namespace odb
assert (!statements_.locked ());
typename object_statements<object_type>::auto_lock l (statements_);
- typename object_traits::image_type& im (statements_.image ());
- object_traits::init (obj, im, this->database ());
+ typename object_traits::image_type& i (statements_.image ());
+ object_traits::init (obj, i, this->database ());
- // Initialize the id image and load the rest of the object
+ // Initialize the id image and binding and load the rest of the object
// (containers, etc).
//
- object_traits::init (statements_.id_image (), object_traits::id (im));
+ typename object_traits::id_image_type& idi (statements_.id_image ());
+ object_traits::init (idi, object_traits::id (i));
+
+ binding& idb (statements_.id_image_binding ());
+ if (idi.version != statements_.id_image_version () || idb.version == 0)
+ {
+ object_traits::bind (idb.bind, idi);
+ statements_.id_image_version (idi.version);
+ idb.version++;
+ }
+
object_traits::load_ (statements_, obj);
statements_.load_delayed ();