mirror of
https://github.com/rbock/sqlpp11.git
synced 2026-05-09 04:39:50 -05:00
Updated return types for executing custom queries
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user