diff --git a/include/sqlpp11/concat.h b/include/sqlpp11/concat.h index ecae74ce..2670f64f 100644 --- a/include/sqlpp11/concat.h +++ b/include/sqlpp11/concat.h @@ -29,6 +29,7 @@ #include #include +#include #include namespace sqlpp diff --git a/include/sqlpp11/functions.h b/include/sqlpp11/functions.h index a01aa323..058a3b48 100644 --- a/include/sqlpp11/functions.h +++ b/include/sqlpp11/functions.h @@ -101,7 +101,7 @@ namespace sqlpp template struct value_list_t // to be used in .in() method { - using _traits = make_traits>; + using _traits = make_traits, ::sqlpp::tag::expression>; using _recursive_traits = make_recursive_traits<>; using _container_t = Container; diff --git a/include/sqlpp11/insert_value_list.h b/include/sqlpp11/insert_value_list.h index 6a0f804c..75675f11 100644 --- a/include/sqlpp11/insert_value_list.h +++ b/include/sqlpp11/insert_value_list.h @@ -34,6 +34,7 @@ #include #include #include +#include namespace sqlpp { diff --git a/include/sqlpp11/into.h b/include/sqlpp11/into.h index 3c6c388c..2454528a 100644 --- a/include/sqlpp11/into.h +++ b/include/sqlpp11/into.h @@ -113,7 +113,7 @@ namespace sqlpp _statement_t::_check_consistency(); static_assert(_statement_t::_get_static_no_of_parameters() == 0, "cannot run insert directly with parameters, use prepare instead"); - return db.insert(*this); + return db.insert(_get_statement()); } template @@ -122,7 +122,7 @@ namespace sqlpp { _statement_t::_check_consistency(); - return {{}, db.prepare_insert(*this)}; + return {{}, db.prepare_insert(_get_statement())}; } }; }; diff --git a/include/sqlpp11/prepared_insert.h b/include/sqlpp11/prepared_insert.h index c6f963e7..e32c73c8 100644 --- a/include/sqlpp11/prepared_insert.h +++ b/include/sqlpp11/prepared_insert.h @@ -35,7 +35,7 @@ namespace sqlpp template struct prepared_insert_t { - using _parameter_list_t = typename Insert::_parameter_list_t; + using _parameter_list_t = make_parameter_list_t; using _prepared_statement_t = typename Db::_prepared_statement_t; auto _run(Db& db) const diff --git a/include/sqlpp11/prepared_remove.h b/include/sqlpp11/prepared_remove.h index 593f75ce..672ab5a6 100644 --- a/include/sqlpp11/prepared_remove.h +++ b/include/sqlpp11/prepared_remove.h @@ -35,7 +35,7 @@ namespace sqlpp template struct prepared_remove_t { - using _parameter_list_t = typename Remove::_parameter_list_t; + using _parameter_list_t = make_parameter_list_t; using _prepared_statement_t = typename Db::_prepared_statement_t; auto _run(Db& db) const diff --git a/include/sqlpp11/prepared_select.h b/include/sqlpp11/prepared_select.h index da958a73..2c74e9a2 100644 --- a/include/sqlpp11/prepared_select.h +++ b/include/sqlpp11/prepared_select.h @@ -36,7 +36,7 @@ namespace sqlpp struct prepared_select_t { using _result_row_t = typename Select::template _result_row_t; - using _parameter_list_t = parameters_of; using _dynamic_names_t = typename Select::_dynamic_names_t; using _prepared_statement_t = typename Database::_prepared_statement_t; diff --git a/include/sqlpp11/prepared_update.h b/include/sqlpp11/prepared_update.h index 071ee404..8d51b32d 100644 --- a/include/sqlpp11/prepared_update.h +++ b/include/sqlpp11/prepared_update.h @@ -35,7 +35,7 @@ namespace sqlpp template struct prepared_update_t { - using _parameter_list_t = typename Update::_parameter_list_t; + using _parameter_list_t = make_parameter_list_t; using _prepared_statement_t = typename Db::_prepared_statement_t; auto _run(Db& db) const diff --git a/include/sqlpp11/remove.h b/include/sqlpp11/remove.h index 38a686b8..d3bc1142 100644 --- a/include/sqlpp11/remove.h +++ b/include/sqlpp11/remove.h @@ -62,7 +62,7 @@ namespace sqlpp _statement_t::_check_consistency(); static_assert(_statement_t::_get_static_no_of_parameters() == 0, "cannot run remove directly with parameters, use prepare instead"); - return db.remove(*this); + return db.remove(_get_statement()); } template @@ -71,7 +71,7 @@ namespace sqlpp { _statement_t::_check_consistency(); - return {{}, db.prepare_remove(*this)}; + return {{}, db.prepare_remove(_get_statement())}; } }; }; diff --git a/include/sqlpp11/select_column_list.h b/include/sqlpp11/select_column_list.h index eb14feb1..602bcf3f 100644 --- a/include/sqlpp11/select_column_list.h +++ b/include/sqlpp11/select_column_list.h @@ -299,7 +299,7 @@ namespace sqlpp { _statement_t::_check_consistency(); - return {{}, get_dynamic_names(), db.prepare_select(*this)}; + return {{}, get_dynamic_names(), db.prepare_select(_get_statement())}; } }; diff --git a/include/sqlpp11/single_table.h b/include/sqlpp11/single_table.h index e2a83a9e..167323b6 100644 --- a/include/sqlpp11/single_table.h +++ b/include/sqlpp11/single_table.h @@ -132,7 +132,7 @@ namespace sqlpp _check_consistency(); static_assert(_get_static_no_of_parameters() == 0, "cannot run insert directly with parameters, use prepare instead"); - return db.insert(*this); + return db.insert(_get_statement()); } template @@ -141,7 +141,7 @@ namespace sqlpp { _check_consistency(); - return {{}, db.prepare_insert(*this)}; + return {{}, db.prepare_insert(_get_statement())}; } }; }; diff --git a/include/sqlpp11/sort_order.h b/include/sqlpp11/sort_order.h index ae8d92bd..f7d0f72e 100644 --- a/include/sqlpp11/sort_order.h +++ b/include/sqlpp11/sort_order.h @@ -28,6 +28,7 @@ #define SQLPP_SORT_ORDER_H #include +#include namespace sqlpp { diff --git a/tests/PreparedTest.cpp b/tests/PreparedTest.cpp index f36abf8c..dcf339a5 100644 --- a/tests/PreparedTest.cpp +++ b/tests/PreparedTest.cpp @@ -90,6 +90,7 @@ int main() { auto s = select(all_of(t)).from(t).where(t.beta.like(parameter(t.beta)) and t.alpha == parameter(t.alpha) or t.gamma != parameter(t.gamma)); auto p = db.prepare(s); + p.params.alpha = 7; using S = decltype(s); using T = sqlpp::make_parameter_list_t; T npl;