diff --git a/include/sqlpp11/insert_value_list.h b/include/sqlpp11/insert_value_list.h index 0dab1c9a..46e8b4ea 100644 --- a/include/sqlpp11/insert_value_list.h +++ b/include/sqlpp11/insert_value_list.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2015, Roland Bock + * Copyright (c) 2013-2016, Roland Bock * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -635,6 +635,20 @@ namespace sqlpp return context; } }; + + template + auto insert_set(Assignments... assignments) + -> decltype(statement_t().set(assignments...)) + { + return statement_t().set(assignments...); + } + + template + auto dynamic_insert_set(Assignments... assignments) + -> decltype(statement_t().dynamic_set(assignments...)) + { + return statement_t().dynamic_set(assignments...); + } } #endif diff --git a/tests/CustomQuery.cpp b/tests/CustomQuery.cpp index a35574cb..fc8d3ab5 100644 --- a/tests/CustomQuery.cpp +++ b/tests/CustomQuery.cpp @@ -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();