diff --git a/include/boost/mysql/statement.hpp b/include/boost/mysql/statement.hpp index 335799aa..f0f1f232 100644 --- a/include/boost/mysql/statement.hpp +++ b/include/boost/mysql/statement.hpp @@ -104,7 +104,7 @@ public: CompletionToken&& token BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type) ) { - return async_execute_statement( + return async_execute( make_execute_params(params), result, std::forward(token) diff --git a/test/integration/utils/src/async_callback.cpp b/test/integration/utils/src/async_callback.cpp index ba74a8c3..49b902d2 100644 --- a/test/integration/utils/src/async_callback.cpp +++ b/test/integration/utils/src/async_callback.cpp @@ -142,10 +142,7 @@ public: ); }); } - network_result connect( - er_endpoint kind, - const boost::mysql::handshake_params& params - ) override + network_result connect(er_endpoint kind, const handshake_params& params) override { return impl([&](handler h, error_info& info) { return this->conn_ diff --git a/test/integration/utils/src/async_callback_noerrinfo.cpp b/test/integration/utils/src/async_callback_noerrinfo.cpp index 95754eb0..aefe7d2b 100644 --- a/test/integration/utils/src/async_callback_noerrinfo.cpp +++ b/test/integration/utils/src/async_callback_noerrinfo.cpp @@ -5,31 +5,37 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#include "er_network_variant.hpp" -#include "er_connection.hpp" -#include "er_resultset.hpp" -#include "er_statement.hpp" -#include "network_result.hpp" -#include "streams.hpp" -#include "er_impl_common.hpp" -#include "get_endpoint.hpp" -#include "handler_call_tracker.hpp" -#include +#include #include #include #include -#include -#include +#include #include -#include +#include +#include +#include +#include + #include +#include "er_connection.hpp" +#include "er_impl_common.hpp" +#include "er_network_variant.hpp" +#include "er_resultset.hpp" +#include "er_statement.hpp" +#include "get_endpoint.hpp" +#include "handler_call_tracker.hpp" +#include "network_result.hpp" +#include "streams.hpp" + using namespace boost::mysql::test; -using boost::mysql::row; using boost::mysql::error_code; using boost::mysql::error_info; using boost::mysql::field_view; -using boost::mysql::connection_params; +using boost::mysql::handshake_params; +using boost::mysql::row; +using boost::mysql::row_view; +using boost::mysql::rows_view; namespace { @@ -67,116 +73,95 @@ template class async_callback_noerrinfo_resultset : public er_resultset_base { public: - using er_resultset_base::er_resultset_base; - network_result read_one(row& output) override + network_result read_one() override { - return impl([&](handler h) { - return this->r_.async_read_one(output, std::move(h)); + return impl([&](handler h) { + return this->obj().async_read_one(std::move(h)); }); } - network_result> read_many(std::size_t count) override + network_result read_some() override { - return impl>([&](handler> h) { - return this->r_.async_read_many(count, std::move(h)); + return impl([&](handler h) { + return this->obj().async_read_some(std::move(h)); }); } - network_result> read_all() override + network_result read_all() override { - return impl>([&](handler> h) { - return this->r_.async_read_all(std::move(h)); + return impl([&](handler h) { + return this->obj().async_read_all(std::move(h)); }); } }; -template -network_result erase_network_result(network_result>&& r) -{ - return network_result ( - r.err, - erase_resultset(std::move(r.value)) - ); -} - template class async_callback_noerrinfo_statement : public er_statement_base { public: - using er_statement_base::er_statement_base; - using resultset_type = boost::mysql::resultset_base; - - network_result execute_params( - const boost::mysql::execute_params& params + network_result execute_params( + const boost::mysql::execute_params& params, + er_resultset& result ) override { - return erase_network_result(impl([&](handler h) { - return this->stmt_.async_execute(params, std::move(h)); - })); + return impl([&](handler h) { + return this->obj().async_execute(params, this->cast(result), std::move(h)); + }); } - network_result execute_container( - const std::vector& values + network_result execute_collection( + const std::vector& values, + er_resultset& result ) override { - return erase_network_result(impl([&](handler h) { - return this->stmt_.async_execute(values, std::move(h)); - })); + return impl([&](handler h) { + return this->obj().async_execute(values, this->cast(result), std::move(h)); + }); } network_result close() override { return impl([&](handler h) { - return this->stmt_.async_close(std::move(h)); + return this->obj().async_close(std::move(h)); }); } }; -template -network_result erase_network_result(network_result>&& r) -{ - return network_result ( - r.err, - erase_statement(std::move(r.value)) - ); -} - template class async_callback_noerrinfo_connection : public er_connection_base { public: using er_connection_base::er_connection_base; - using statement_type = boost::mysql::statement_base; - using resultset_type = boost::mysql::resultset_base; network_result physical_connect(er_endpoint kind) override { return impl([&](handler h) { - return this->conn_.next_layer().lowest_layer().async_connect(get_endpoint(kind), std::move(h)); + return this->conn_.stream().lowest_layer().async_connect( + get_endpoint(kind), + std::move(h) + ); }); } - network_result connect( - er_endpoint kind, - const boost::mysql::connection_params& params - ) override + network_result connect(er_endpoint kind, const handshake_params& params) override { return impl([&](handler h) { return this->conn_.async_connect(get_endpoint(kind), params, std::move(h)); }); } - network_result handshake(const connection_params& params) override + network_result handshake(const handshake_params& params) override { return impl([&](handler h) { return this->conn_.async_handshake(params, std::move(h)); }); } - network_result query(boost::string_view query) override + network_result query(boost::string_view query, er_resultset& result) override { - return erase_network_result(impl([&](handler h) { - return this->conn_.async_query(query, std::move(h)); - })); + return impl([&](handler h) { + return this->conn_.async_query(query, this->cast(result), std::move(h)); + }); } - network_result prepare_statement(boost::string_view statement) override + network_result prepare_statement(boost::string_view statement, er_statement& stmt) + override { - return erase_network_result(impl([&](handler h) { - return this->conn_.async_prepare_statement(statement, std::move(h)); - })); + return impl([&](handler h) { + return this->conn_.async_prepare_statement(statement, this->cast(stmt), std::move(h)); + }); } network_result quit() override { @@ -193,7 +178,11 @@ public: }; template -class async_callback_noerrinfo_variant : public er_network_variant_base +class async_callback_noerrinfo_variant : public er_network_variant_base< + Stream, + async_callback_noerrinfo_connection, + async_callback_noerrinfo_statement, + async_callback_noerrinfo_resultset> { public: const char* variant_name() const override { return "async_callback_noerrinfo"; } @@ -202,11 +191,9 @@ public: async_callback_noerrinfo_variant tcp; async_callback_noerrinfo_variant tcp_ssl; -} // anon namespace +} // namespace -void boost::mysql::test::add_async_callback_noerrinfo( - std::vector& output -) +void boost::mysql::test::add_async_callback_noerrinfo(std::vector& output) { output.push_back(&tcp); output.push_back(&tcp_ssl);