diff --git a/include/sqlpp11/insert.h b/include/sqlpp11/insert.h index 8f0a5eda..3b27ec16 100644 --- a/include/sqlpp11/insert.h +++ b/include/sqlpp11/insert.h @@ -125,7 +125,7 @@ namespace sqlpp return { _table, _insert_list, - {std::tuple{columns...}}, + {std::tuple...>{{columns}...}}, vendor::insert_value_list_t...>{}, }; } @@ -151,7 +151,7 @@ namespace sqlpp template std::size_t run(Db& db) const { - static_assert(not vendor::is_noop::value, "calling set() or default_values()"); + static_assert(not (vendor::is_noop::value and vendor::is_noop::value) , "calling set() or default_values()"); static_assert(_get_static_no_of_parameters() == 0, "cannot run insert directly with parameters, use prepare instead"); return db.insert(*this); } diff --git a/include/sqlpp11/vendor/column_list.h b/include/sqlpp11/vendor/column_list.h index 24e8a9a5..4659e1b2 100644 --- a/include/sqlpp11/vendor/column_list.h +++ b/include/sqlpp11/vendor/column_list.h @@ -30,6 +30,7 @@ #include #include #include +#include namespace sqlpp { @@ -55,7 +56,7 @@ namespace sqlpp using _prohibited_column_set = typename ::sqlpp::detail::make_set_if::type; static_assert(_prohibited_column_set::size::value == 0, "at least one column argument has a must_not_insert flag in its definition"); - _parameter_tuple_t _columns; + std::tuple...> _columns; }; template diff --git a/include/sqlpp11/vendor/insert_value_list.h b/include/sqlpp11/vendor/insert_value_list.h index 785bbbd1..f3d2b4ba 100644 --- a/include/sqlpp11/vendor/insert_value_list.h +++ b/include/sqlpp11/vendor/insert_value_list.h @@ -87,8 +87,13 @@ namespace sqlpp static Context& _(const T& t, Context& context) { context << " VALUES "; + bool first = true; for (const auto& row : t._insert_values) { + if (not first) + context << ','; + else + first = false; context << '('; interpret_tuple(row, ",", context); context << ')';