[odb-users] Query object A by range of objects B, with 1:n relation

Boris Kolpackov boris at codesynthesis.com
Thu Sep 3 10:50:37 EDT 2015


Hi Markus,

Markus Klemm <markus at markusklemm.net> writes:

> set<decltype(directory::directory_id)> directories;
> odb::query<file>::directory->directory_id.in_range(directories.cbegin(),directories.cend());
> Fails with a sql exception, "wrong syntax near directory_id"

I believe you are getting this error because the range is empty. This,
BTW, has been fixed for the next release of ODB.

Also, chances are, your next question will be how to find files
that belong to directories that in turn match a certain query
condition. For that you would need to use ODB views (Chapter 10).

Boris



More information about the odb-users mailing list