Updated return types for executing custom queries

This commit is contained in:
rbock
2015-03-08 21:06:30 +01:00
parent 4981b1962c
commit 3ca69bf8b8
3 changed files with 11 additions and 6 deletions
+2 -2
View File
@@ -53,13 +53,13 @@ namespace sqlpp
// Execute
template<typename Db, typename Composite>
auto _run(Db& db, const Composite& composite) const -> void
auto _run(Db& db, const Composite& composite) const -> size_t
{
return db.execute(composite);
}
template<typename Db>
auto _run(Db& db) const -> void
auto _run(Db& db) const -> size_t
{
return db.execute(_get_statement());
}
+1 -1
View File
@@ -45,7 +45,7 @@ namespace sqlpp
using _run_check = consistent_t;
auto _run(Db& db) const
-> void
-> size_t
{
return db.run_prepared_execute(*this);
}
+8 -3
View File
@@ -126,15 +126,19 @@ struct MockDbT: public sqlpp::connection
return _run(t, _ok{});
}
void execute(const std::string& command);
size_t execute(const std::string& command)
{
return 0;
}
template<typename Statement,
typename Enable = typename std::enable_if<not std::is_convertible<Statement, std::string>::value, void>::type>
void execute(const Statement& x)
size_t execute(const Statement& x)
{
_serializer_context_t context;
::sqlpp::serialize(x, context);
std::cout << "Running execute call with\n" << context.str() << std::endl;
return execute(context.str());
}
template<typename Insert>
@@ -215,8 +219,9 @@ struct MockDbT: public sqlpp::connection
}
template<typename PreparedExecute>
void run_prepared_execute(const PreparedExecute& x)
size_t run_prepared_execute(const PreparedExecute& x)
{
return 0;
}
template<typename PreparedInsert>