diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-09-02 08:33:25 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-09-02 08:33:25 +0200 |
commit | 9715f388db714fb663b854883e4cad5f2aa3c860 (patch) | |
tree | febbbba7980a6891784440d86911b13befe108a7 /odb/pgsql/simple-object-statements.txx | |
parent | b5ed13549a87dccb56f756d6fbc5f7bf537e9640 (diff) |
Support for versioning simple value in object
Diffstat (limited to 'odb/pgsql/simple-object-statements.txx')
-rw-r--r-- | odb/pgsql/simple-object-statements.txx | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/odb/pgsql/simple-object-statements.txx b/odb/pgsql/simple-object-statements.txx index 999dc9c..5933aa5 100644 --- a/odb/pgsql/simple-object-statements.txx +++ b/odb/pgsql/simple-object-statements.txx @@ -8,6 +8,7 @@ #include <odb/exceptions.hxx> #include <odb/pgsql/connection.hxx> +#include <odb/pgsql/traits-calls.hxx> namespace odb { @@ -96,8 +97,9 @@ namespace odb } template <typename T> + template <typename STS> void object_statements<T>:: - load_delayed_ () + load_delayed_ (const schema_version_migration* svm) { database& db (connection ().database ()); @@ -112,7 +114,9 @@ namespace odb if (l.loader == 0) { - if (!object_traits::find_ (*this, &l.id)) + traits_calls<T> tc (svm); + + if (!tc.find_ (static_cast<STS&> (*this), &l.id)) throw object_not_persistent (); object_traits::callback (db, *l.obj, callback_event::pre_load); @@ -121,11 +125,14 @@ namespace odb // loads being added to the delayed_ vector. We need to process // those before we call the post callback. // - object_traits::init (*l.obj, image (), &db); - object_traits::load_ (*this, *l.obj); // Load containers, etc. + tc.init (*l.obj, image (), &db); + + // Load containers, etc. + // + object_traits::load_ (static_cast<STS&> (*this), *l.obj); if (!delayed_.empty ()) - load_delayed_ (); + load_delayed_<STS> (svm); // Temporarily unlock the statement for the post_load call so that // it can load objects of this type recursively. This is safe to do @@ -141,7 +148,7 @@ namespace odb } } else - l.loader (db, l.id, *l.obj); + l.loader (db, l.id, *l.obj, svm); pointer_cache_traits::load (ig.position ()); ig.release (); |