mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-15 20:31:16 +08:00
Added prepare_select to MockDb.
This commit is contained in:
parent
8c8b95d14e
commit
67f1b09acb
@ -32,15 +32,15 @@
|
||||
|
||||
namespace sqlpp
|
||||
{
|
||||
template<typename Db, typename Select>
|
||||
template<typename Database, typename Select>
|
||||
struct prepared_select_t
|
||||
{
|
||||
using _result_row_t = typename Select::_result_row_t;
|
||||
using _result_row_t = typename Select::template _result_row_t<Database>;
|
||||
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<decltype(db.run_prepared_select(*this)), _result_row_t>
|
||||
{
|
||||
return {db.run_prepared_select(*this), _dynamic_names};
|
||||
|
@ -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)
|
||||
|
||||
|
@ -142,6 +142,18 @@ struct MockDb: public sqlpp::connection
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<typename Select>
|
||||
_prepared_statement_t prepare_select(Select& x)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template<typename PreparedSelect>
|
||||
result_t run_prepared_select(PreparedSelect& x)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -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<S>::type;
|
||||
T npl;
|
||||
|
Loading…
Reference in New Issue
Block a user