Moved static asserts for inconsistency errors much closer to call site

This commit is contained in:
rbock
2014-11-17 19:05:22 +01:00
parent 4ef00a03b2
commit 59734b3f51
24 changed files with 121 additions and 103 deletions
+4 -1
View File
@@ -70,17 +70,20 @@ namespace sqlpp
custom_query_t& operator=(custom_query_t&&) = default;
~custom_query_t() = default;
static void _check_consistency() {};
using _consistency_check = consistent_t;
template<typename Db>
auto _run(Db& db) const -> decltype(std::declval<_methods_t>()._run(db, *this))
{
static_assert(_get_static_no_of_parameters() == 0, "cannot run execute directly with parameters, use prepare instead");
_run_check{};
return _methods_t::_run(db, *this);
}
template<typename Db>
auto _prepare(Db& db) const -> decltype(std::declval<_methods_t>()._prepare(db, *this))
{
_prepare_check{};
return _methods_t::_prepare(db, *this);
}