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

Markus Klemm markus at markusklemm.net
Thu Sep 3 11:09:49 EDT 2015


I figured out the problem in the instant you replied: Solution 1 was right, but I accidentialy built the final query with the order query first.

But thank you very much for the odb view tip, I stick very close to the documentation, and read it thru first, but I wasn't aware/forggot that views are the way to go for this transitive purpose: Thank you and I'm sorry.

Good day and Mit freundlichen Grüßen

Markus Klemm



> Am 03.09.2015 um 16:50 schrieb Boris Kolpackov <boris at codesynthesis.com>:
> 
> 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