[odb-users] Query only intermediate polymorphic objects

Dieter Govaerts dieter.govaerts at bricsys.com
Thu Nov 9 11:27:12 EST 2017


On Thursday, 9 November, 2017 16:29, "Boris Kolpackov" <boris at codesynthesis.com> said:

> This is undocumented, but that column is also available in the
> query object and is called 'typeid_'. You can use this information
> to restrict the types of objects you are getting, for example:
> 
> using DerivedAIdQuery = odb::query<DerivedAIdView>
> 
> odb::result<DerivedAIdView> r(
>   db()->query<DerivedAIdView>(
>     DerivedAIdQuery::typeid_ == "DerivedA"));

Thank you Boris.

Is that discriminator string value somewhere available? Something like odb::object_traits<DerivedA>::discriminator ?

Dieter




More information about the odb-users mailing list