diff --git a/include/sqlpp11/sqlite3/connection.h b/include/sqlpp11/sqlite3/connection.h index 1909782a..8a92d394 100644 --- a/include/sqlpp11/sqlite3/connection.h +++ b/include/sqlpp11/sqlite3/connection.h @@ -372,14 +372,28 @@ namespace sqlpp return static_cast(sqlite3_changes(native_handle())); } - template < - typename Execute, - typename Enable = typename std::enable_if::value, void>::type> - size_t execute(const Execute& x) - { - _context_t context{*this}; - serialize(x, context); - return execute(context.str()); + template < + typename Execute, + typename std::enable_if::value + and not sqlpp::is_prepared_statement_t::value, int>::type = 0> + size_t execute(const Execute& x) + { + static_assert(not sqlpp::is_select_t::value, "argument must not be a select statement - use operator() instead"); + + _context_t context{*this}; + serialize(x, context); + return execute(context.str()); + } + + template < + typename Execute, + typename std::enable_if::value, int>::type = 0> + size_t execute(const Execute& x) + { + static_assert(not sqlpp::is_select_t::value, "argument must not be a select statement - use operator() instead"); + + operator()(x); + return static_cast(sqlite3_changes(native_handle())); } template