From 3ca69bf8b808aa27c11c2d802e4f789fb9345c50 Mon Sep 17 00:00:00 2001 From: rbock Date: Sun, 8 Mar 2015 21:06:30 +0100 Subject: [PATCH] Updated return types for executing custom queries --- include/sqlpp11/noop.h | 4 ++-- include/sqlpp11/prepared_execute.h | 2 +- tests/MockDb.h | 11 ++++++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/include/sqlpp11/noop.h b/include/sqlpp11/noop.h index 0a023b80..0c4c0f57 100644 --- a/include/sqlpp11/noop.h +++ b/include/sqlpp11/noop.h @@ -53,13 +53,13 @@ namespace sqlpp // Execute template - auto _run(Db& db, const Composite& composite) const -> void + auto _run(Db& db, const Composite& composite) const -> size_t { return db.execute(composite); } template - auto _run(Db& db) const -> void + auto _run(Db& db) const -> size_t { return db.execute(_get_statement()); } diff --git a/include/sqlpp11/prepared_execute.h b/include/sqlpp11/prepared_execute.h index 7027bbc0..b7d4939f 100644 --- a/include/sqlpp11/prepared_execute.h +++ b/include/sqlpp11/prepared_execute.h @@ -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); } diff --git a/tests/MockDb.h b/tests/MockDb.h index 7516dd77..c2b3f461 100644 --- a/tests/MockDb.h +++ b/tests/MockDb.h @@ -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::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 @@ -215,8 +219,9 @@ struct MockDbT: public sqlpp::connection } template - void run_prepared_execute(const PreparedExecute& x) + size_t run_prepared_execute(const PreparedExecute& x) { + return 0; } template