aboutsummaryrefslogtreecommitdiff
path: root/odb/mysql/object-statements.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-08-18 11:38:40 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-08-18 11:38:40 +0200
commite4420208045f1bfb1a9c1fc726b4f6d1ae268f92 (patch)
tree48a0659705d8e6af14e6eb1b992ce500518f6818 /odb/mysql/object-statements.ixx
parent58c30a12b89a0c5dcaf93b142f4a781cb9363add (diff)
Fix custom recursive loading in post_load callback
Before we called the callback while holding the statements locked. As a result, if the callback tried to load another object of this type, it failed. Now we unlock the statements (since we have completely loaded the object from ODB's point of view) and then call the callback. The callback test has been updated to test this situation.
Diffstat (limited to 'odb/mysql/object-statements.ixx')
-rw-r--r--odb/mysql/object-statements.ixx16
1 files changed, 16 insertions, 0 deletions
diff --git a/odb/mysql/object-statements.ixx b/odb/mysql/object-statements.ixx
index 9dc772b..713a09f 100644
--- a/odb/mysql/object-statements.ixx
+++ b/odb/mysql/object-statements.ixx
@@ -8,6 +8,22 @@ namespace odb
namespace mysql
{
//
+ // auto_unlock
+ //
+ inline object_statements_base::auto_unlock::
+ auto_unlock (object_statements_base& s)
+ : s_ (s)
+ {
+ s_.unlock ();
+ }
+
+ inline object_statements_base::auto_unlock::
+ ~auto_unlock ()
+ {
+ s_.lock ();
+ }
+
+ //
// auto_lock
//
template <typename T>