[odb-users] data corruption when persisting object

Andrew Cunningham odb at a-cunningham.com
Fri Nov 25 21:16:20 EST 2016


Boris,
I reproduced Anton's issue - though it seems suspiciously  like something I
reported in 2.4.0, apparently it is different.


Andrew

On Thu, Nov 24, 2016 at 11:24 PM, Anton Paymyshev <anton.paymyshev at gmail.com
> wrote:

> 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