Added insert_set to create first custom insert

This commit is contained in:
rbock
2016-03-31 07:11:41 +02:00
parent 712c79cb8a
commit 0b8ccaa985
2 changed files with 19 additions and 1 deletions

View File

@@ -57,6 +57,10 @@ int CustomQuery(int, char* [])
std::cerr << row.alpha << std::endl;
}
// Create a custom "insert or ignore"
db(custom_query(sqlpp::insert(), sqlpp::verbatim(" OR IGNORE"), into(t),
insert_set(t.beta = "sample", t.gamma = true)));
// A custom (select ... into) with adjusted return type
// The first argument with a return type is the select, but the custom query is really an insert. Thus, we tell it so.
printer.reset();