[odb-users] ODB Query using relation

Boris Kolpackov boris at codesynthesis.com
Wed Jan 8 02:04:50 EST 2014


Hi Adrian,

Adrian Imboden <mail at adrianimboden.ch> writes:

> > This one is a bit trickier since ODB does not yet support querying
> > of containers.
>
> Is there already some idea how to implement this feature? If there is
> need, I could invest some time too.

The hard part is exactly that: figuring out what the proper semantics
and the syntax to go with it are and how to implement them.

When people are using a container in a query condition, we need to
know which elements to consider. This can be some specific element
(e.g., the first element), any element, all elements, a range of
elements, etc.

I think the "any element" will be the most widely used case and is
the one we definitely have to support. Others, I am not sure it will
even be possible to implement in SQL in any sane way (e.g., all
elements, a range of elements). Maybe what we should do is expose
the index column (or the key column for maps) to the user so that
they can create whatever conditions they want. Something along
these lines:

query::authTokens.index == 0 && query::authTokens->hash == 123

[Note the problem with this syntax: a container element may also
have a data member named index.]

It is also not clear how to implement the "all elements" case
with this approach, or in SQL in a sane/portable way in general.

So, as you can see, there are a lot of questions that need
thinking and answering ;-). If you (or anyone else) want to
spend some time on that, we can try to flesh this feature out.

Boris



More information about the odb-users mailing list