-
Notifications
You must be signed in to change notification settings - Fork 355
Open
Description
Hi,
I am trying to insert multiple rows at a time and some rows should use the default value for specific columns.
I am using insert_into with calls for values.add for each row to add but now handling the fields that should be default is not as easy.
auto query = sqlpp::postgresql::insert_into(t_table)
.columns(t_table.id,
t_table.name,
t_table.description)
.returning(t_table.id);
for (const auto& row: rows)
{
query.values.add(t_table.id = row.id? row.id: sqlpp::default_value, // << This line does not compile
t_table.name = row.name,
t_table.description= row.description);
}
I am aware of dynamic_insert_into and use it in many places, but not sure if it supports adding multiple rows as above.
I am happy with any one of the following answers:
- Telling me it is possible in sqlpp11 and giving some guidance on achieving this
- Telling me it is not possible but it is possible in sqlpp23
- Telling me it is neither possible in sqlp11 nor sqlpp23 and putting it onto a "feature request" list for sqlpp23
Metadata
Metadata
Assignees
Labels
No labels