[odb-users] Containers of containers not detected

Andrew Cunningham odb at a-cunningham.com
Sun May 1 13:39:51 EDT 2016


Hi Boris,
Ok, thanks for the explanation.
I suspected that mapping a vector to a BLOB makes it "not a container" and
is supported.

So that brings up a problem I have found shown in the "reproducer" project
I sent to you.

When the std::vector/BLOB from my example is in a odd::section , it is not
properly restored.
The BLOB/vector is restored with the correct size, but the restored data is
garbage.
This only happens in the case as shown in my example, where the BLOB is
part of an object that is a value of a std::map<key,value>

Andrew



On Sun, May 1, 2016 at 7:32 AM, Boris Kolpackov <boris at codesynthesis.com>
wrote:

> Hi Andrew,
>
> Andrew Cunningham <andrew at a-cunningham.com> writes:
>
> > It would be great if the ODB compiler could detect "containers of
> > containers" and throw an error.
>
> It does normally. In your case, you have a container of containers
> via a value type, which ODB doesn't detect. I've added an item to
> our bug list.
>
>
> > - Is the "container of containers" a hard limitation that will remain in
> > future versions of ODB?
>
> There are no plans to support this feature "out of the box" since the
> complexity will make the mapping incomprehensible for most users.
>
> What we will support is emulation of containers of containers. It will
> require quite a bit of work from your side but the benefit is that you
> will understand the (complexity) of the resulting schema (and can decide
> whether it is worth it).
>
>
> scm.codesynthesis.com/?p=odb/libodb.git;a=commit;h=ad515f85e807f8d21a1b70f5ed288705e0f2f531
>
>
> > - Is the fact that using a BLOB makes the code work just blind good luck?
>
> No, if you map an inner vector to BLOB, then it is no longer a container
> in the ODB sense (i.e., it is not mapped to its own table).
>
> Boris
>


More information about the odb-users mailing list