From c4d059b6346398e936dbc8c84d35c90aa4ec4253 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 25 Apr 2011 09:46:59 +0200 Subject: Pass id binding instead of id image in container traits This will allow us to reuse things more. --- odb/sqlite/result.txx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'odb/sqlite/result.txx') 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::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 (); -- cgit v1.1