diff --git a/include/sqlpp11/prepared_select.h b/include/sqlpp11/prepared_select.h index 7c7947e9..68aecf1e 100644 --- a/include/sqlpp11/prepared_select.h +++ b/include/sqlpp11/prepared_select.h @@ -32,15 +32,15 @@ namespace sqlpp { - template + template struct prepared_select_t { - using _result_row_t = typename Select::_result_row_t; + using _result_row_t = typename Select::template _result_row_t; using _parameter_list_t = typename Select::_parameter_list_t; using _dynamic_names_t = typename Select::_dynamic_names_t; - using _prepared_statement_t = typename Db::_prepared_statement_t; + using _prepared_statement_t = typename Database::_prepared_statement_t; - auto _run(Db& db) const + auto _run(Database& db) const -> result_t { return {db.run_prepared_select(*this), _dynamic_names}; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index c98458d0..c572a9ea 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -6,13 +6,13 @@ macro (build_and_run arg) add_test(${arg} ${arg}) endmacro () -build_and_run(InterpretTest) +#build_and_run(InterpretTest) #build_and_run(InsertTest) #build_and_run(RemoveTest) #build_and_run(UpdateTest) -build_and_run(SelectTest) +#build_and_run(SelectTest) #build_and_run(FunctionTest) -#build_and_run(PreparedTest) +build_and_run(PreparedTest) find_package(PythonInterp REQUIRED) diff --git a/tests/MockDb.h b/tests/MockDb.h index bb12350c..4cd8b384 100644 --- a/tests/MockDb.h +++ b/tests/MockDb.h @@ -142,6 +142,18 @@ struct MockDb: public sqlpp::connection return 0; } + template + _prepared_statement_t prepare_select(Select& x) + { + return nullptr; + } + + template + result_t run_prepared_select(PreparedSelect& x) + { + return {}; + } + }; #endif diff --git a/tests/PreparedTest.cpp b/tests/PreparedTest.cpp index abeb5c15..b39b037c 100644 --- a/tests/PreparedTest.cpp +++ b/tests/PreparedTest.cpp @@ -88,6 +88,7 @@ int main() // Wonderful, now take a look at the parameter list of a select { 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); using S = decltype(s); using T = sqlpp::make_parameter_list_t::type; T npl;