-
Notifications
You must be signed in to change notification settings - Fork 498
Open
Description
HI,
I have exactly same problem as below
refer to stackoverflow:
https://stackoverflow.com/questions/42260993/c-soci-query-into-vector-of-custom-object
to select batch of size rows to vector of custom struct.
template<> struct type_conversion
{
typedef values base_type;
static void from_base(const values& v, indicator /* ind */, Event& event)
{
event.m_id = v.get<std::string>("id");
event.m_title = v.get<std::string>("Title");
event.m_description = v.get<std::string>("Description");
event.m_date = v.get<std::tm>("Date");
}
static void to_base(const Event& event, values& v, indicator& ind)
{
v.set("id", event.m_id);
v.set("Title", event.m_title);
v.set("Description", event.m_description);
v.set("Date", event.m_date);
ind = i_ok;
}
};
std::vector<Event*> events;
sql << "SELECT * FROM Event", into(events)
The compilation error below:
Just wonder if this is supported in the latest version or workaround is necessary for this?
BTW, batch update from vector as well.
Appreciate the clarity.
Metadata
Metadata
Assignees
Labels
No labels