[odb-users] Using members that are sets in a odb::sqlite::database::query

stefano dalbosco stef.dalbosco at hotmail.com
Wed Mar 16 06:54:09 EDT 2022


Hi,

I have a db object with a member that is a set of strings and I like to create a odb::sqlite::database::query which given a string returns all objects that contains that string in there set.
This is how my object looks like:

#pragma db object
struct person
{
    #pragma db id auto
    unsigned id_;

    std::string name_;
    std::set<std::string> emails_;
}

I can then easily query on name like this:
    db.query<person>(odb::query<person>::name == "John");
which return all the persons with name John. But is there a similar way to get all the persons with a specific email?
I tried using odb::query<person>:: emails but this is undefined.

Thanks in advance,
Stef


More information about the odb-users mailing list