Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

query and update into/using vector #1257

Open
Open
query and update into/using vector#1257

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("id");
event.m_title = v.get("Title");
event.m_description = v.get("Description");
event.m_date = v.get("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 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions