From e601747fca529bf75f912624ec8891b4276e3a11 Mon Sep 17 00:00:00 2001 From: Roland Bock Date: Tue, 7 Jan 2014 07:29:55 +0100 Subject: [PATCH] Assert that parameters are not used in dynamic elements of a query. This will need to change in the future --- include/sqlpp11/detail/serializable.h | 2 ++ include/sqlpp11/having.h | 3 ++- include/sqlpp11/where.h | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/sqlpp11/detail/serializable.h b/include/sqlpp11/detail/serializable.h index 99c78454..1f7e754a 100644 --- a/include/sqlpp11/detail/serializable.h +++ b/include/sqlpp11/detail/serializable.h @@ -30,6 +30,7 @@ #include #include #include +#include namespace sqlpp { @@ -65,6 +66,7 @@ namespace sqlpp template struct _impl_t: public _impl_base { + static_assert(not make_parameter_list_t::type::size::value, "parameters not supported in dynamic query parts"); _impl_t(const T& t): _t(t) {} diff --git a/include/sqlpp11/having.h b/include/sqlpp11/having.h index 93db4806..fe9927e3 100644 --- a/include/sqlpp11/having.h +++ b/include/sqlpp11/having.h @@ -71,7 +71,8 @@ namespace sqlpp size_t _set_parameter_index(size_t index) { - return set_parameter_index(_expressions, index); + index = set_parameter_index(_expressions, index); + return index; } _parameter_tuple_t _expressions; diff --git a/include/sqlpp11/where.h b/include/sqlpp11/where.h index bd774dd6..782f1ac4 100644 --- a/include/sqlpp11/where.h +++ b/include/sqlpp11/where.h @@ -71,7 +71,8 @@ namespace sqlpp size_t _set_parameter_index(size_t index) { - return set_parameter_index(_expressions, index); + index = set_parameter_index(_expressions, index); + return index; } _parameter_tuple_t _expressions;