[odb-users] data corruption when persisting object

Anton Paymyshev anton.paymyshev at gmail.com
Fri Nov 25 02:24:30 EST 2016


I get the same issue with a9 version.

This is what i get in odb generated "bool access::object_traits_impl<
::TestObject, id_sqlite >::init":
...
    // val
    //
    if (sk == statement_insert)
    {
      ::TestValue const& v =
        o.val;

      composite_value_traits< ::TestValue, id_sqlite >::init (
        i.val_value,
        v,
        sk);
    }
...

This is when I move my struct out of section:

    // val
    //
    {
      ::TestValue const& v =
        o.val;

      if (composite_value_traits< ::TestValue, id_sqlite >::init (
            i.val_value,
            v,
            sk))
        grew = true;
    }

Looks like the first snipped ignores grew return value from
composite_value_traits<...>::init. I added grew handling manually and
data appears correctly persisted on disk.



More information about the odb-users mailing list