Refactored connection_impl to allow diagnostics-aware tokens

All async_initiate's in the library are now uniformly called with a diagnostics* as 1st argument
This commit is contained in:
Anarthal (Rubén Pérez) 2024-07-15 17:57:11 +02:00 committed by GitHub
parent cf74314c4e
commit 0060494170
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
33 changed files with 232 additions and 271 deletions

View File

@ -531,7 +531,7 @@ public:
/// \copydoc connection::prepare_statement
statement prepare_statement(string_view stmt, error_code& err, diagnostics& diag)
{
return impl_.run(detail::prepare_statement_algo_params{&diag, stmt}, err);
return impl_.run(detail::prepare_statement_algo_params{stmt}, err, diag);
}
/// \copydoc prepare_statement
@ -560,7 +560,8 @@ public:
BOOST_MYSQL_RETURN_TYPE(detail::async_prepare_statement_t<CompletionToken&&>)
{
return impl_.async_run(
detail::prepare_statement_algo_params{&diag, stmt},
detail::prepare_statement_algo_params{stmt},
diag,
std::forward<CompletionToken>(token)
);
}
@ -568,7 +569,7 @@ public:
/// \copydoc connection::close_statement
void close_statement(const statement& stmt, error_code& err, diagnostics& diag)
{
impl_.run(impl_.make_params_close_statement(stmt, diag), err);
impl_.run(impl_.make_params_close_statement(stmt), err, diag);
}
/// \copydoc close_statement
@ -593,16 +594,14 @@ public:
auto async_close_statement(const statement& stmt, diagnostics& diag, CompletionToken&& token)
BOOST_MYSQL_RETURN_TYPE(detail::async_close_statement_t<CompletionToken&&>)
{
return impl_.async_run(
impl_.make_params_close_statement(stmt, diag),
std::forward<CompletionToken>(token)
);
return impl_
.async_run(impl_.make_params_close_statement(stmt), diag, std::forward<CompletionToken>(token));
}
/// \copydoc connection::read_some_rows
rows_view read_some_rows(execution_state& st, error_code& err, diagnostics& diag)
{
return impl_.run(impl_.make_params_read_some_rows(st, diag), err);
return impl_.run(impl_.make_params_read_some_rows(st), err, diag);
}
/// \copydoc read_some_rows(execution_state&,error_code&,diagnostics&)
@ -630,10 +629,8 @@ public:
auto async_read_some_rows(execution_state& st, diagnostics& diag, CompletionToken&& token)
BOOST_MYSQL_RETURN_TYPE(detail::async_read_some_rows_dynamic_t<CompletionToken&&>)
{
return impl_.async_run(
impl_.make_params_read_some_rows(st, diag),
std::forward<CompletionToken>(token)
);
return impl_
.async_run(impl_.make_params_read_some_rows(st), diag, std::forward<CompletionToken>(token));
}
#ifdef BOOST_MYSQL_CXX14
@ -673,7 +670,7 @@ public:
diagnostics& diag
)
{
return impl_.run(impl_.make_params_read_some_rows_static(st, output, diag), err);
return impl_.run(impl_.make_params_read_some_rows_static(st, output), err, diag);
}
/**
@ -808,7 +805,8 @@ public:
)
{
return impl_.async_run(
impl_.make_params_read_some_rows_static(st, output, diag),
impl_.make_params_read_some_rows_static(st, output),
diag,
std::forward<CompletionToken>(token)
);
}
@ -818,7 +816,7 @@ public:
template <BOOST_MYSQL_EXECUTION_STATE_TYPE ExecutionStateType>
void read_resultset_head(ExecutionStateType& st, error_code& err, diagnostics& diag)
{
return impl_.run(impl_.make_params_read_resultset_head(st, diag), err);
return impl_.run(impl_.make_params_read_resultset_head(st), err, diag);
}
/// \copydoc read_resultset_head
@ -848,10 +846,8 @@ public:
auto async_read_resultset_head(ExecutionStateType& st, diagnostics& diag, CompletionToken&& token)
BOOST_MYSQL_RETURN_TYPE(detail::async_read_resultset_head_t<CompletionToken&&>)
{
return impl_.async_run(
impl_.make_params_read_resultset_head(st, diag),
std::forward<CompletionToken>(token)
);
return impl_
.async_run(impl_.make_params_read_resultset_head(st), diag, std::forward<CompletionToken>(token));
}
/**
@ -877,7 +873,7 @@ public:
*/
void set_character_set(const character_set& charset, error_code& err, diagnostics& diag)
{
impl_.run(impl_.make_params_set_character_set(charset, diag), err);
impl_.run(detail::set_character_set_algo_params{charset}, err, diag);
}
/// \copydoc set_character_set
@ -909,13 +905,14 @@ public:
BOOST_MYSQL_RETURN_TYPE(detail::async_set_character_set_t<CompletionToken&&>)
{
return impl_.async_run(
impl_.make_params_set_character_set(charset, diag),
detail::set_character_set_algo_params{charset},
diag,
std::forward<CompletionToken>(token)
);
}
/// \copydoc connection::ping
void ping(error_code& err, diagnostics& diag) { impl_.run(impl_.make_params_ping(diag), err); }
void ping(error_code& err, diagnostics& diag) { impl_.run(detail::ping_algo_params{}, err, diag); }
/// \copydoc ping
void ping()
@ -938,7 +935,7 @@ public:
auto async_ping(diagnostics& diag, CompletionToken&& token)
BOOST_MYSQL_RETURN_TYPE(detail::async_ping_t<CompletionToken&&>)
{
return impl_.async_run(impl_.make_params_ping(diag), std::forward<CompletionToken>(token));
return impl_.async_run(detail::ping_algo_params{}, diag, std::forward<CompletionToken>(token));
}
/**
@ -978,7 +975,7 @@ public:
*/
void reset_connection(error_code& err, diagnostics& diag)
{
impl_.run(impl_.make_params_reset_connection(diag), err);
impl_.run(detail::reset_connection_algo_params{}, err, diag);
}
/// \copydoc reset_connection
@ -1009,10 +1006,8 @@ public:
auto async_reset_connection(diagnostics& diag, CompletionToken&& token)
BOOST_MYSQL_RETURN_TYPE(detail::async_reset_connection_t<CompletionToken&&>)
{
return impl_.async_run(
impl_.make_params_reset_connection(diag),
std::forward<CompletionToken>(token)
);
return impl_
.async_run(detail::reset_connection_algo_params{}, diag, std::forward<CompletionToken>(token));
}
/**
@ -1036,7 +1031,7 @@ public:
*/
void close(error_code& err, diagnostics& diag)
{
this->impl_.run(this->impl_.make_params_close(diag), err);
impl_.run(detail::close_connection_algo_params{}, err, diag);
}
/// \copydoc close
@ -1066,10 +1061,8 @@ public:
auto async_close(diagnostics& diag, CompletionToken&& token)
BOOST_MYSQL_RETURN_TYPE(detail::async_close_connection_t<CompletionToken&&>)
{
return this->impl_.async_run(
this->impl_.make_params_close(diag),
std::forward<CompletionToken>(token)
);
return this->impl_
.async_run(detail::close_connection_algo_params{}, diag, std::forward<CompletionToken>(token));
}
/**
@ -1100,7 +1093,7 @@ public:
diagnostics& diag
)
{
impl_.run(impl_.make_params_pipeline(req, res, diag), err);
impl_.run(impl_.make_params_pipeline(req, res), err, diag);
}
/// \copydoc run_pipeline
@ -1141,10 +1134,8 @@ public:
CompletionToken&& token
) BOOST_MYSQL_RETURN_TYPE(detail::async_run_pipeline_t<CompletionToken&&>)
{
return this->impl_.async_run(
impl_.make_params_pipeline(req, res, diag),
std::forward<CompletionToken>(token)
);
return this->impl_
.async_run(impl_.make_params_pipeline(req, res), diag, std::forward<CompletionToken>(token));
}
};

View File

@ -302,7 +302,7 @@ public:
*/
void handshake(const handshake_params& params, error_code& ec, diagnostics& diag)
{
impl_.run(impl_.make_params_handshake(params, diag), ec);
impl_.run(impl_.make_params_handshake(params), ec, diag);
}
/// \copydoc handshake
@ -342,10 +342,8 @@ public:
CompletionToken&& token BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)
) BOOST_MYSQL_RETURN_TYPE(detail::async_handshake_t<CompletionToken&&>)
{
return impl_.async_run(
impl_.make_params_handshake(params, diag),
std::forward<CompletionToken>(token)
);
return impl_
.async_run(impl_.make_params_handshake(params), diag, std::forward<CompletionToken>(token));
}
/**
@ -559,7 +557,7 @@ public:
*/
statement prepare_statement(string_view stmt, error_code& err, diagnostics& diag)
{
return impl_.run(detail::prepare_statement_algo_params{&diag, stmt}, err);
return impl_.run(detail::prepare_statement_algo_params{stmt}, err, diag);
}
/// \copydoc prepare_statement
@ -603,7 +601,8 @@ public:
) BOOST_MYSQL_RETURN_TYPE(detail::async_prepare_statement_t<CompletionToken&&>)
{
return impl_.async_run(
detail::prepare_statement_algo_params{&diag, stmt},
detail::prepare_statement_algo_params{stmt},
diag,
std::forward<CompletionToken>(token)
);
}
@ -622,7 +621,7 @@ public:
*/
void close_statement(const statement& stmt, error_code& err, diagnostics& diag)
{
impl_.run(impl_.make_params_close_statement(stmt, diag), err);
impl_.run(impl_.make_params_close_statement(stmt), err, diag);
}
/// \copydoc close_statement
@ -662,10 +661,8 @@ public:
CompletionToken&& token BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)
) BOOST_MYSQL_RETURN_TYPE(detail::async_close_statement_t<CompletionToken&&>)
{
return impl_.async_run(
impl_.make_params_close_statement(stmt, diag),
std::forward<CompletionToken>(token)
);
return impl_
.async_run(impl_.make_params_close_statement(stmt), diag, std::forward<CompletionToken>(token));
}
/**
@ -685,7 +682,7 @@ public:
*/
rows_view read_some_rows(execution_state& st, error_code& err, diagnostics& diag)
{
return impl_.run(impl_.make_params_read_some_rows(st, diag), err);
return impl_.run(impl_.make_params_read_some_rows(st), err, diag);
}
/// \copydoc read_some_rows(execution_state&,error_code&,diagnostics&)
@ -724,10 +721,8 @@ public:
CompletionToken&& token BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)
) BOOST_MYSQL_RETURN_TYPE(detail::async_read_some_rows_dynamic_t<CompletionToken&&>)
{
return impl_.async_run(
impl_.make_params_read_some_rows(st, diag),
std::forward<CompletionToken>(token)
);
return impl_
.async_run(impl_.make_params_read_some_rows(st), diag, std::forward<CompletionToken>(token));
}
#ifdef BOOST_MYSQL_CXX14
@ -768,7 +763,7 @@ public:
diagnostics& diag
)
{
return impl_.run(impl_.make_params_read_some_rows_static(st, output, diag), err);
return impl_.run(impl_.make_params_read_some_rows_static(st, output), err, diag);
}
/**
@ -908,7 +903,8 @@ public:
)
{
return impl_.async_run(
impl_.make_params_read_some_rows_static(st, output, diag),
impl_.make_params_read_some_rows_static(st, output),
diag,
std::forward<CompletionToken>(token)
);
}
@ -936,7 +932,7 @@ public:
template <BOOST_MYSQL_EXECUTION_STATE_TYPE ExecutionStateType>
void read_resultset_head(ExecutionStateType& st, error_code& err, diagnostics& diag)
{
return impl_.run(impl_.make_params_read_resultset_head(st, diag), err);
return impl_.run(impl_.make_params_read_resultset_head(st), err, diag);
}
/// \copydoc read_resultset_head
@ -978,10 +974,8 @@ public:
CompletionToken&& token BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)
) BOOST_MYSQL_RETURN_TYPE(detail::async_read_resultset_head_t<CompletionToken&&>)
{
return impl_.async_run(
impl_.make_params_read_resultset_head(st, diag),
std::forward<CompletionToken>(token)
);
return impl_
.async_run(impl_.make_params_read_resultset_head(st), diag, std::forward<CompletionToken>(token));
}
/**
@ -995,7 +989,7 @@ public:
* in a long-running query, the ping request won't be answered until the query is
* finished.
*/
void ping(error_code& err, diagnostics& diag) { impl_.run(impl_.make_params_ping(diag), err); }
void ping(error_code& err, diagnostics& diag) { impl_.run(detail::ping_algo_params{}, err, diag); }
/// \copydoc ping
void ping()
@ -1029,7 +1023,7 @@ public:
CompletionToken&& token BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)
) BOOST_MYSQL_RETURN_TYPE(detail::async_ping_t<CompletionToken&&>)
{
return impl_.async_run(impl_.make_params_ping(diag), std::forward<CompletionToken>(token));
return impl_.async_run(detail::ping_algo_params{}, diag, std::forward<CompletionToken>(token));
}
/**
@ -1066,7 +1060,7 @@ public:
*/
void reset_connection(error_code& err, diagnostics& diag)
{
impl_.run(impl_.make_params_reset_connection(diag), err);
impl_.run(detail::reset_connection_algo_params{}, err, diag);
}
/// \copydoc reset_connection
@ -1101,10 +1095,8 @@ public:
CompletionToken&& token BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)
) BOOST_MYSQL_RETURN_TYPE(detail::async_reset_connection_t<CompletionToken&&>)
{
return impl_.async_run(
impl_.make_params_reset_connection(diag),
std::forward<CompletionToken>(token)
);
return impl_
.async_run(detail::reset_connection_algo_params{}, diag, std::forward<CompletionToken>(token));
}
/**
@ -1121,7 +1113,7 @@ public:
detail::is_socket_stream<Stream>::value,
"close can only be used if Stream satisfies the SocketStream concept"
);
impl_.run(impl_.make_params_close(diag), err);
impl_.run(detail::close_connection_algo_params{}, err, diag);
}
/// \copydoc close
@ -1167,7 +1159,8 @@ public:
detail::is_socket_stream<Stream>::value,
"async_close can only be used if Stream satisfies the SocketStream concept"
);
return impl_.async_run(impl_.make_params_close(diag), std::forward<CompletionToken>(token));
return impl_
.async_run(detail::close_connection_algo_params{}, diag, std::forward<CompletionToken>(token));
}
/**
@ -1180,7 +1173,10 @@ public:
* requirements, use \ref connection::close instead of this function,
* as it also takes care of closing the underlying stream.
*/
void quit(error_code& err, diagnostics& diag) { impl_.run(impl_.make_params_quit(diag), err); }
void quit(error_code& err, diagnostics& diag)
{
impl_.run(detail::quit_connection_algo_params{}, err, diag);
}
/// \copydoc quit
void quit()
@ -1213,7 +1209,8 @@ public:
CompletionToken&& token BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)
) BOOST_MYSQL_RETURN_TYPE(detail::async_quit_connection_t<CompletionToken&&>)
{
return impl_.async_run(impl_.make_params_quit(diag), std::forward<CompletionToken>(token));
return impl_
.async_run(detail::quit_connection_algo_params{}, diag, std::forward<CompletionToken>(token));
}
/**

View File

@ -285,9 +285,9 @@ class connection_pool
template <class Handler>
void operator()(
Handler&& h,
diagnostics* diag,
std::shared_ptr<detail::pool_impl> self,
std::chrono::steady_clock::duration timeout,
diagnostics* diag
std::chrono::steady_clock::duration timeout
)
{
async_get_connection_erased(std::move(self), timeout, diag, std::forward<Handler>(h));
@ -311,18 +311,18 @@ class connection_pool
-> decltype(asio::async_initiate<CompletionToken, void(error_code, pooled_connection)>(
initiate_get_connection{},
token,
diag,
impl_,
timeout,
diag
timeout
))
{
BOOST_ASSERT(valid());
return asio::async_initiate<CompletionToken, void(error_code, pooled_connection)>(
initiate_get_connection{},
token,
diag,
impl_,
timeout,
diag
timeout
);
}

View File

@ -25,7 +25,6 @@ namespace boost {
namespace mysql {
class rows_view;
class diagnostics;
class statement;
class stage_response;
@ -37,7 +36,6 @@ struct pipeline_request_stage;
struct connect_algo_params
{
diagnostics* diag;
handshake_params hparams;
bool secure_channel; // Are we using UNIX sockets or any other secure channel?
@ -46,7 +44,6 @@ struct connect_algo_params
struct handshake_algo_params
{
diagnostics* diag;
handshake_params hparams;
bool secure_channel; // Are we using UNIX sockets or any other secure channel?
@ -55,7 +52,6 @@ struct handshake_algo_params
struct execute_algo_params
{
diagnostics* diag;
any_execution_request req;
execution_processor* proc;
@ -64,7 +60,6 @@ struct execute_algo_params
struct start_execution_algo_params
{
diagnostics* diag;
any_execution_request req;
execution_processor* proc;
@ -73,7 +68,6 @@ struct start_execution_algo_params
struct read_resultset_head_algo_params
{
diagnostics* diag;
execution_processor* proc;
using result_type = void;
@ -81,7 +75,6 @@ struct read_resultset_head_algo_params
struct read_some_rows_algo_params
{
diagnostics* diag;
execution_processor* proc;
output_ref output;
@ -90,7 +83,6 @@ struct read_some_rows_algo_params
struct read_some_rows_dynamic_algo_params
{
diagnostics* diag;
execution_state_impl* exec_st;
using result_type = rows_view;
@ -98,7 +90,6 @@ struct read_some_rows_dynamic_algo_params
struct prepare_statement_algo_params
{
diagnostics* diag;
string_view stmt_sql;
using result_type = statement;
@ -106,7 +97,6 @@ struct prepare_statement_algo_params
struct close_statement_algo_params
{
diagnostics* diag;
std::uint32_t stmt_id;
using result_type = void;
@ -114,21 +104,16 @@ struct close_statement_algo_params
struct ping_algo_params
{
diagnostics* diag;
using result_type = void;
};
struct reset_connection_algo_params
{
diagnostics* diag;
using result_type = void;
};
struct set_character_set_algo_params
{
diagnostics* diag;
character_set charset;
using result_type = void;
@ -136,21 +121,16 @@ struct set_character_set_algo_params
struct quit_connection_algo_params
{
diagnostics* diag;
using result_type = void;
};
struct close_connection_algo_params
{
diagnostics* diag;
using result_type = void;
};
struct run_pipeline_algo_params
{
diagnostics* diag;
span<const std::uint8_t> request_buffer;
span<const pipeline_request_stage> request_stages;
std::vector<stage_response>* response;

View File

@ -66,7 +66,7 @@ struct connection_state_deleter
BOOST_MYSQL_DECL std::vector<field_view>& get_shared_fields(connection_state&);
template <class AlgoParams>
any_resumable_ref setup(connection_state&, const AlgoParams&);
any_resumable_ref setup(connection_state&, diagnostics&, const AlgoParams&);
// Note: AlgoParams should have !is_void_result
template <class AlgoParams>
@ -185,6 +185,11 @@ struct generic_algo_handler
connection_state* st;
};
// Note: async_initiate args be, at least:
// 1. a diagnostics*
// 2. a (possibly smart) pointer to an I/O object
// 3. everything else
// This uniform structure allows to write completion tokens with extra functionality
class connection_impl
{
std::unique_ptr<engine> engine_;
@ -195,20 +200,22 @@ class connection_impl
typename AlgoParams::result_type run_impl(
AlgoParams params,
error_code& ec,
diagnostics& diag,
std::true_type /* has_void_result */
)
{
engine_->run(setup(*st_, params), ec);
engine_->run(setup(*st_, diag, params), ec);
}
template <class AlgoParams>
typename AlgoParams::result_type run_impl(
AlgoParams params,
error_code& ec,
diagnostics& diag,
std::false_type /* has_void_result */
)
{
engine_->run(setup(*st_, params), ec);
engine_->run(setup(*st_, diag, params), ec);
return get_result<AlgoParams>(*st_);
}
@ -217,11 +224,12 @@ class connection_impl
engine& eng,
connection_state& st,
AlgoParams params,
diagnostics& diag,
Handler&& handler,
std::true_type /* has_void_result */
)
{
eng.async_run(setup(st, params), std::forward<Handler>(handler));
eng.async_run(setup(st, diag, params), std::forward<Handler>(handler));
}
template <class AlgoParams, class Handler>
@ -229,39 +237,51 @@ class connection_impl
engine& eng,
connection_state& st,
AlgoParams params,
diagnostics& diag,
Handler&& handler,
std::false_type /* has_void_result */
)
{
using intermediate_handler_t = generic_algo_handler<AlgoParams, typename std::decay<Handler>::type>;
eng.async_run(setup(st, params), intermediate_handler_t(std::forward<Handler>(handler), st));
eng.async_run(setup(st, diag, params), intermediate_handler_t(std::forward<Handler>(handler), st));
}
template <class AlgoParams, class Handler>
static void async_run_impl(engine& eng, connection_state& st, AlgoParams params, Handler&& handler)
static void async_run_impl(
engine& eng,
connection_state& st,
AlgoParams params,
diagnostics& diag,
Handler&& handler
)
{
async_run_impl(eng, st, params, std::forward<Handler>(handler), has_void_result<AlgoParams>{});
async_run_impl(eng, st, params, diag, std::forward<Handler>(handler), has_void_result<AlgoParams>{});
}
struct run_algo_initiation
{
template <class Handler, class AlgoParams>
void operator()(Handler&& handler, engine* eng, connection_state* st, AlgoParams params)
void operator()(
Handler&& handler,
diagnostics* diag,
engine* eng,
connection_state* st,
AlgoParams params
)
{
async_run_impl(*eng, *st, params, std::forward<Handler>(handler));
async_run_impl(*eng, *st, params, *diag, std::forward<Handler>(handler));
}
};
// Connect
static connect_algo_params make_params_connect(diagnostics& diag, const handshake_params& params)
static connect_algo_params make_params_connect(const handshake_params& params)
{
return connect_algo_params{&diag, params, false};
return connect_algo_params{params, false};
}
static connect_algo_params make_params_connect_v2(diagnostics& diag, const connect_params& params)
static connect_algo_params make_params_connect_v2(const connect_params& params)
{
return connect_algo_params{
&diag,
make_hparams(params),
params.server_address.type() == address_type::unix_path
};
@ -273,15 +293,15 @@ class connection_impl
template <class Handler>
void operator()(
Handler&& handler,
diagnostics* diag,
engine* eng,
connection_state* st,
const EndpointType& endpoint,
handshake_params params,
diagnostics* diag
handshake_params params
)
{
eng->set_endpoint(&endpoint);
async_run_impl(*eng, *st, make_params_connect(*diag, params), std::forward<Handler>(handler));
async_run_impl(*eng, *st, make_params_connect(params), *diag, std::forward<Handler>(handler));
}
};
@ -290,14 +310,14 @@ class connection_impl
template <class Handler>
void operator()(
Handler&& handler,
diagnostics* diag,
engine* eng,
connection_state* st,
const connect_params* params,
diagnostics* diag
const connect_params* params
)
{
eng->set_endpoint(&params->server_address);
async_run_impl(*eng, *st, make_params_connect_v2(*diag, *params), std::forward<Handler>(handler));
async_run_impl(*eng, *st, make_params_connect_v2(*params), *diag, std::forward<Handler>(handler));
}
};
@ -307,18 +327,19 @@ class connection_impl
template <class Handler, class ExecutionRequest>
void operator()(
Handler&& handler,
diagnostics* diag,
engine* eng,
connection_state* st,
const ExecutionRequest& req,
execution_processor* proc,
diagnostics* diag
execution_processor* proc
)
{
auto getter = make_request_getter(req, get_shared_fields(*st));
async_run_impl(
*eng,
*st,
execute_algo_params{diag, getter.get(), proc},
execute_algo_params{getter.get(), proc},
*diag,
std::forward<Handler>(handler)
);
}
@ -330,18 +351,19 @@ class connection_impl
template <class Handler, class ExecutionRequest>
void operator()(
Handler&& handler,
diagnostics* diag,
engine* eng,
connection_state* st,
const ExecutionRequest& req,
execution_processor* proc,
diagnostics* diag
execution_processor* proc
)
{
auto getter = make_request_getter(req, get_shared_fields(*st));
async_run_impl(
*eng,
*st,
start_execution_algo_params{diag, getter.get(), proc},
start_execution_algo_params{getter.get(), proc},
*diag,
std::forward<Handler>(handler)
);
}
@ -375,16 +397,17 @@ public:
// Generic algorithm
template <class AlgoParams>
typename AlgoParams::result_type run(AlgoParams params, error_code& ec)
typename AlgoParams::result_type run(AlgoParams params, error_code& ec, diagnostics& diag)
{
return run_impl(params, ec, has_void_result<AlgoParams>{});
return run_impl(params, ec, diag, has_void_result<AlgoParams>{});
}
template <class AlgoParams, class CompletionToken>
auto async_run(AlgoParams params, CompletionToken&& token)
auto async_run(AlgoParams params, diagnostics& diag, CompletionToken&& token)
-> decltype(asio::async_initiate<CompletionToken, completion_signature_t<AlgoParams>>(
run_algo_initiation(),
token,
&diag,
engine_.get(),
st_.get(),
params
@ -393,6 +416,7 @@ public:
return asio::async_initiate<CompletionToken, completion_signature_t<AlgoParams>>(
run_algo_initiation(),
token,
&diag,
engine_.get(),
st_.get(),
params
@ -409,13 +433,13 @@ public:
)
{
engine_->set_endpoint(&endpoint);
run(make_params_connect(diag, params), err);
run(make_params_connect(params), err, diag);
}
void connect_v2(const connect_params& params, error_code& err, diagnostics& diag)
{
engine_->set_endpoint(&params.server_address);
run(make_params_connect_v2(diag, params), err);
run(make_params_connect_v2(params), err, diag);
}
template <class EndpointType, class CompletionToken>
@ -428,21 +452,21 @@ public:
-> decltype(asio::async_initiate<CompletionToken, void(error_code)>(
initiate_connect<EndpointType>(),
token,
&diag,
engine_.get(),
st_.get(),
endpoint,
params,
&diag
params
))
{
return asio::async_initiate<CompletionToken, void(error_code)>(
initiate_connect<EndpointType>(),
token,
&diag,
engine_.get(),
st_.get(),
endpoint,
params,
&diag
params
);
}
@ -451,26 +475,26 @@ public:
-> decltype(asio::async_initiate<CompletionToken, void(error_code)>(
initiate_connect_v2(),
token,
&diag,
engine_.get(),
st_.get(),
&params,
&diag
&params
))
{
return asio::async_initiate<CompletionToken, void(error_code)>(
initiate_connect_v2(),
token,
&diag,
engine_.get(),
st_.get(),
&params,
&diag
&params
);
}
// Handshake
handshake_algo_params make_params_handshake(const handshake_params& params, diagnostics& diag) const
handshake_algo_params make_params_handshake(const handshake_params& params) const
{
return {&diag, params, false};
return {params, false};
}
// Execute
@ -478,7 +502,7 @@ public:
void execute(const ExecutionRequest& req, ResultsType& result, error_code& err, diagnostics& diag)
{
auto getter = make_request_getter(req, get_shared_fields(*st_));
run(execute_algo_params{&diag, getter.get(), &access::get_impl(result).get_interface()}, err);
run(execute_algo_params{getter.get(), &access::get_impl(result).get_interface()}, err, diag);
}
template <class ExecutionRequest, class ResultsType, class CompletionToken>
@ -491,21 +515,21 @@ public:
-> decltype(asio::async_initiate<CompletionToken, void(error_code)>(
initiate_execute(),
token,
&diag,
engine_.get(),
st_.get(),
std::forward<ExecutionRequest>(req),
&access::get_impl(result).get_interface(),
&diag
&access::get_impl(result).get_interface()
))
{
return asio::async_initiate<CompletionToken, void(error_code)>(
initiate_execute(),
token,
&diag,
engine_.get(),
st_.get(),
std::forward<ExecutionRequest>(req),
&access::get_impl(result).get_interface(),
&diag
&access::get_impl(result).get_interface()
);
}
@ -519,8 +543,7 @@ public:
)
{
auto getter = make_request_getter(req, get_shared_fields(*st_));
run(start_execution_algo_params{&diag, getter.get(), &access::get_impl(exec_st).get_interface()},
err);
run(start_execution_algo_params{getter.get(), &access::get_impl(exec_st).get_interface()}, err, diag);
}
template <class ExecutionRequest, class ExecutionStateType, class CompletionToken>
@ -533,41 +556,38 @@ public:
-> decltype(asio::async_initiate<CompletionToken, void(error_code)>(
initiate_start_execution(),
token,
&diag,
engine_.get(),
st_.get(),
std::forward<ExecutionRequest>(req),
&access::get_impl(exec_st).get_interface(),
&diag
&access::get_impl(exec_st).get_interface()
))
{
return asio::async_initiate<CompletionToken, void(error_code)>(
initiate_start_execution(),
token,
&diag,
engine_.get(),
st_.get(),
std::forward<ExecutionRequest>(req),
&access::get_impl(exec_st).get_interface(),
&diag
&access::get_impl(exec_st).get_interface()
);
}
// Read some rows (dynamic)
read_some_rows_dynamic_algo_params make_params_read_some_rows(execution_state& st, diagnostics& diag)
const
read_some_rows_dynamic_algo_params make_params_read_some_rows(execution_state& st) const
{
return {&diag, &access::get_impl(st).get_interface()};
return {&access::get_impl(st).get_interface()};
}
// Read some rows (static)
template <class SpanElementType, class ExecutionState>
read_some_rows_algo_params make_params_read_some_rows_static(
ExecutionState& exec_st,
span<SpanElementType> output,
diagnostics& diag
span<SpanElementType> output
) const
{
return {
&diag,
&access::get_impl(exec_st).get_interface(),
access::get_impl(exec_st).make_output_ref(output)
};
@ -575,45 +595,19 @@ public:
// Read resultset head
template <class ExecutionStateType>
read_resultset_head_algo_params make_params_read_resultset_head(ExecutionStateType& st, diagnostics& diag)
const
read_resultset_head_algo_params make_params_read_resultset_head(ExecutionStateType& st) const
{
return {&diag, &detail::access::get_impl(st).get_interface()};
return {&detail::access::get_impl(st).get_interface()};
}
// Close statement
close_statement_algo_params make_params_close_statement(statement stmt, diagnostics& diag) const
{
return {&diag, stmt.id()};
}
// Set character set
set_character_set_algo_params make_params_set_character_set(
const character_set& charset,
diagnostics& diag
) const
{
return {&diag, charset};
}
// Ping
ping_algo_params make_params_ping(diagnostics& diag) const { return {&diag}; }
// Reset connection
reset_connection_algo_params make_params_reset_connection(diagnostics& diag) const { return {&diag}; }
// Quit connection
quit_connection_algo_params make_params_quit(diagnostics& diag) const { return {&diag}; }
// Close connection
close_connection_algo_params make_params_close(diagnostics& diag) const { return {&diag}; }
close_statement_algo_params make_params_close_statement(statement stmt) const { return {stmt.id()}; }
// Run pipeline. Separately compiled to avoid including the pipeline header here
BOOST_MYSQL_DECL
static run_pipeline_algo_params make_params_pipeline(
const pipeline_request& req,
std::vector<stage_response>& response,
diagnostics& diag
std::vector<stage_response>& response
);
};
@ -621,8 +615,11 @@ public:
// BOOST_ASIO_INITFN_AUTO_RESULT_TYPE are no longer enough.
// Helper typedefs to reduce duplication
template <class AlgoParams, class CompletionToken>
using async_run_t = decltype(std::declval<connection_impl&>()
.async_run(std::declval<AlgoParams>(), std::declval<CompletionToken>()));
using async_run_t = decltype(std::declval<connection_impl&>().async_run(
std::declval<AlgoParams>(),
std::declval<diagnostics&>(),
std::declval<CompletionToken>()
));
template <class EndpointType, class CompletionToken>
using async_connect_t = decltype(std::declval<connection_impl&>().async_connect(

View File

@ -11,6 +11,7 @@
#pragma once
#include <boost/mysql/character_set.hpp>
#include <boost/mysql/diagnostics.hpp>
#include <boost/mysql/pipeline.hpp>
#include <boost/mysql/detail/connection_impl.hpp>
@ -92,21 +93,21 @@ boost::system::result<boost::mysql::character_set> boost::mysql::detail::connect
boost::mysql::detail::run_pipeline_algo_params boost::mysql::detail::connection_impl::make_params_pipeline(
const pipeline_request& req,
std::vector<stage_response>& response,
diagnostics& diag
std::vector<stage_response>& response
)
{
const auto& req_impl = access::get_impl(req);
return {&diag, req_impl.buffer_, req_impl.stages_, &response};
return {req_impl.buffer_, req_impl.stages_, &response};
}
template <class AlgoParams>
boost::mysql::detail::any_resumable_ref boost::mysql::detail::setup(
connection_state& st,
diagnostics& diag,
const AlgoParams& params
)
{
return st.setup(params);
return st.setup(diag, params);
}
template <class AlgoParams>
@ -118,7 +119,7 @@ typename AlgoParams::result_type boost::mysql::detail::get_result(const connecti
#ifdef BOOST_MYSQL_SEPARATE_COMPILATION
#define BOOST_MYSQL_INSTANTIATE_SETUP(op_params_type) \
template any_resumable_ref setup<op_params_type>(connection_state&, const op_params_type&);
template any_resumable_ref setup<op_params_type>(connection_state&, diagnostics&, const op_params_type&);
#define BOOST_MYSQL_INSTANTIATE_GET_RESULT(op_params_type) \
template op_params_type::result_type get_result<op_params_type>(const connection_state&);

View File

@ -8,6 +8,8 @@
#ifndef BOOST_MYSQL_IMPL_INTERNAL_SANSIO_CLOSE_CONNECTION_HPP
#define BOOST_MYSQL_IMPL_INTERNAL_SANSIO_CLOSE_CONNECTION_HPP
#include <boost/mysql/diagnostics.hpp>
#include <boost/mysql/detail/algo_params.hpp>
#include <boost/mysql/detail/next_action.hpp>
@ -26,7 +28,7 @@ class close_connection_algo
error_code stored_ec_;
public:
close_connection_algo(close_connection_algo_params params) noexcept : quit_({params.diag}) {}
close_connection_algo(diagnostics& diag, close_connection_algo_params) noexcept : quit_(diag, {}) {}
next_action resume(connection_state_data& st, error_code ec)
{

View File

@ -28,7 +28,7 @@ inline run_pipeline_algo_params setup_close_statement_pipeline(
st.shared_pipeline_stages = {
{{pipeline_stage_kind::close_statement, seqnum1, {}}, {pipeline_stage_kind::ping, seqnum2, {}}}
};
return {params.diag, st.write_buffer, st.shared_pipeline_stages, nullptr};
return {st.write_buffer, st.shared_pipeline_stages, nullptr};
}
} // namespace detail

View File

@ -29,8 +29,8 @@ class connect_algo
error_code stored_ec_;
public:
connect_algo(connect_algo_params params) noexcept
: handshake_({params.diag, params.hparams, params.secure_channel})
connect_algo(diagnostics& diag, connect_algo_params params) noexcept
: handshake_(diag, {params.hparams, params.secure_channel})
{
}

View File

@ -90,7 +90,8 @@ public:
: st_data_(read_buffer_size, max_buffer_size, transport_supports_ssl),
algo_(top_level_algo<quit_connection_algo>(
st_data_,
quit_connection_algo_params{&st_data_.shared_diag}
st_data_.shared_diag,
quit_connection_algo_params{}
))
{
}
@ -99,22 +100,26 @@ public:
connection_state_data& data() { return st_data_; }
template <class AlgoParams>
any_resumable_ref setup(AlgoParams params)
any_resumable_ref setup(diagnostics& diag, AlgoParams params)
{
return any_resumable_ref(algo_.emplace<top_level_algo<get_algo_t<AlgoParams>>>(st_data_, params));
return any_resumable_ref(algo_.emplace<top_level_algo<get_algo_t<AlgoParams>>>(st_data_, diag, params)
);
}
any_resumable_ref setup(close_statement_algo_params params)
any_resumable_ref setup(diagnostics& diag, close_statement_algo_params params)
{
return setup(setup_close_statement_pipeline(st_data_, params));
return setup(diag, setup_close_statement_pipeline(st_data_, params));
}
any_resumable_ref setup(reset_connection_algo_params params)
any_resumable_ref setup(diagnostics& diag, reset_connection_algo_params)
{
return setup(setup_reset_connection_pipeline(st_data_, params));
return setup(diag, setup_reset_connection_pipeline(st_data_));
}
any_resumable_ref setup(ping_algo_params params) { return setup(setup_ping_pipeline(st_data_, params)); }
any_resumable_ref setup(diagnostics& diag, ping_algo_params)
{
return setup(diag, setup_ping_pipeline(st_data_));
}
template <typename AlgoParams>
typename AlgoParams::result_type result() const

View File

@ -32,9 +32,8 @@ class read_execute_response_algo
read_some_rows_algo read_some_rows_st_;
public:
read_execute_response_algo(diagnostics* diag, execution_processor* proc) noexcept
: read_head_st_(read_resultset_head_algo_params{diag, proc}),
read_some_rows_st_(read_some_rows_algo_params{diag, proc, output_ref()})
read_execute_response_algo(diagnostics& diag, execution_processor* proc) noexcept
: read_head_st_(diag, {proc}), read_some_rows_st_(diag, {proc, output_ref()})
{
}
@ -84,9 +83,8 @@ class execute_algo
execution_processor& processor() { return read_response_st_.processor(); }
public:
execute_algo(execute_algo_params params) noexcept
: start_execution_st_(start_execution_algo_params{params.diag, params.req, params.proc}),
read_response_st_(params.diag, params.proc)
execute_algo(diagnostics& diag, execute_algo_params params) noexcept
: start_execution_st_(diag, {params.req, params.proc}), read_response_st_(diag, params.proc)
{
}

View File

@ -193,8 +193,8 @@ class handshake_algo
}
public:
handshake_algo(handshake_algo_params params) noexcept
: diag_(params.diag), hparams_(params.hparams), secure_channel_(params.secure_channel)
handshake_algo(diagnostics& diag, handshake_algo_params params) noexcept
: diag_(&diag), hparams_(params.hparams), secure_channel_(params.secure_channel)
{
}

View File

@ -25,7 +25,9 @@ class read_ping_response_algo
std::uint8_t seqnum_{0};
public:
read_ping_response_algo(diagnostics* diag, std::uint8_t seqnum) noexcept : diag_(diag), seqnum_(seqnum) {}
read_ping_response_algo(diagnostics& diag, std::uint8_t seqnum) noexcept : diag_(&diag), seqnum_(seqnum)
{
}
next_action resume(connection_state_data& st, error_code ec)
{
@ -45,13 +47,12 @@ public:
}
};
inline run_pipeline_algo_params setup_ping_pipeline(connection_state_data& st, ping_algo_params params)
inline run_pipeline_algo_params setup_ping_pipeline(connection_state_data& st)
{
st.write_buffer.clear();
auto seqnum = serialize_top_level(ping_command{}, st.write_buffer);
st.shared_pipeline_stages[0] = {pipeline_stage_kind::ping, seqnum, {}};
return {
params.diag,
st.write_buffer,
{st.shared_pipeline_stages.data(), 1},
nullptr

View File

@ -43,8 +43,8 @@ class read_prepare_statement_response_algo
}
public:
read_prepare_statement_response_algo(diagnostics* diag, std::uint8_t seqnum) noexcept
: diag_(diag), sequence_number_(seqnum)
read_prepare_statement_response_algo(diagnostics& diag, std::uint8_t seqnum) noexcept
: diag_(&diag), sequence_number_(seqnum)
{
}
@ -89,8 +89,8 @@ class prepare_statement_algo
string_view stmt_sql_;
public:
prepare_statement_algo(prepare_statement_algo_params params) noexcept
: read_response_st_(params.diag, 0u), stmt_sql_(params.stmt_sql)
prepare_statement_algo(diagnostics& diag, prepare_statement_algo_params params) noexcept
: read_response_st_(diag, 0u), stmt_sql_(params.stmt_sql)
{
}

View File

@ -29,7 +29,7 @@ class quit_connection_algo
std::uint8_t sequence_number_{0};
public:
quit_connection_algo(quit_connection_algo_params params) noexcept : diag_(params.diag) {}
quit_connection_algo(diagnostics& diag, quit_connection_algo_params) noexcept : diag_(&diag) {}
diagnostics& diag() { return *diag_; }

View File

@ -69,8 +69,8 @@ class read_resultset_head_algo
} state_;
public:
read_resultset_head_algo(read_resultset_head_algo_params params) noexcept
: diag_(params.diag), proc_(params.proc)
read_resultset_head_algo(diagnostics& diag, read_resultset_head_algo_params params) noexcept
: diag_(&diag), proc_(params.proc)
{
}

View File

@ -94,8 +94,8 @@ class read_some_rows_algo
}
public:
read_some_rows_algo(read_some_rows_algo_params params) noexcept
: diag_(params.diag), proc_(params.proc), output_(params.output)
read_some_rows_algo(diagnostics& diag, read_some_rows_algo_params params) noexcept
: diag_(&diag), proc_(params.proc), output_(params.output)
{
}

View File

@ -29,8 +29,8 @@ namespace detail {
class read_some_rows_dynamic_algo : public read_some_rows_algo
{
public:
read_some_rows_dynamic_algo(read_some_rows_dynamic_algo_params params) noexcept
: read_some_rows_algo(read_some_rows_algo_params{params.diag, params.exec_st, output_ref()})
read_some_rows_dynamic_algo(diagnostics& diag, read_some_rows_dynamic_algo_params params) noexcept
: read_some_rows_algo(diag, read_some_rows_algo_params{params.exec_st, output_ref()})
{
}

View File

@ -29,8 +29,8 @@ class read_reset_connection_response_algo
std::uint8_t seqnum_{0};
public:
read_reset_connection_response_algo(diagnostics* diag, std::uint8_t seqnum) noexcept
: diag_(diag), seqnum_(seqnum)
read_reset_connection_response_algo(diagnostics& diag, std::uint8_t seqnum) noexcept
: diag_(&diag), seqnum_(seqnum)
{
}
@ -63,10 +63,7 @@ public:
}
};
inline run_pipeline_algo_params setup_reset_connection_pipeline(
connection_state_data& st,
reset_connection_algo_params params
)
inline run_pipeline_algo_params setup_reset_connection_pipeline(connection_state_data& st)
{
st.write_buffer.clear();
st.shared_pipeline_stages[0] = {
@ -75,7 +72,6 @@ inline run_pipeline_algo_params setup_reset_connection_pipeline(
{}
};
return {
params.diag,
st.write_buffer,
{st.shared_pipeline_stages.data(), 1},
nullptr

View File

@ -98,23 +98,23 @@ class run_pipeline_algo
auto& processor = access::get_impl((*response_)[current_stage_index_]).get_processor();
processor.reset(stage.stage_specific.enc, st.meta_mode);
processor.sequence_number() = stage.seqnum;
read_response_algo_.execute = {&temp_diag_, &processor};
read_response_algo_.execute = {temp_diag_, &processor};
break;
}
case pipeline_stage_kind::prepare_statement:
read_response_algo_.prepare_statement = {&temp_diag_, stage.seqnum};
read_response_algo_.prepare_statement = {temp_diag_, stage.seqnum};
break;
case pipeline_stage_kind::close_statement:
// Close statement doesn't have a response
read_response_algo_.nothing = nullptr;
break;
case pipeline_stage_kind::set_character_set:
read_response_algo_.set_character_set = {&temp_diag_, stage.stage_specific.charset, stage.seqnum};
read_response_algo_.set_character_set = {temp_diag_, stage.stage_specific.charset, stage.seqnum};
break;
case pipeline_stage_kind::reset_connection:
read_response_algo_.reset_connection = {&temp_diag_, stage.seqnum};
read_response_algo_.reset_connection = {temp_diag_, stage.seqnum};
break;
case pipeline_stage_kind::ping: read_response_algo_.ping = {&temp_diag_, stage.seqnum}; break;
case pipeline_stage_kind::ping: read_response_algo_.ping = {temp_diag_, stage.seqnum}; break;
default: BOOST_ASSERT(false);
}
}
@ -182,8 +182,8 @@ class run_pipeline_algo
}
public:
run_pipeline_algo(run_pipeline_algo_params params) noexcept
: diag_(params.diag),
run_pipeline_algo(diagnostics& diag, run_pipeline_algo_params params) noexcept
: diag_(&diag),
request_buffer_(params.request_buffer),
stages_(params.request_stages),
response_(params.response)

View File

@ -49,8 +49,8 @@ class read_set_character_set_response_algo
std::uint8_t seqnum_{0};
public:
read_set_character_set_response_algo(diagnostics* diag, character_set charset, std::uint8_t seqnum)
: diag_(diag), charset_(charset), seqnum_(seqnum)
read_set_character_set_response_algo(diagnostics& diag, character_set charset, std::uint8_t seqnum)
: diag_(&diag), charset_(charset), seqnum_(seqnum)
{
}
character_set charset() const { return charset_; }
@ -97,8 +97,8 @@ class set_character_set_algo
}
public:
set_character_set_algo(set_character_set_algo_params params) noexcept
: read_response_st_(params.diag, params.charset, 0u)
set_character_set_algo(diagnostics& diag, set_character_set_algo_params params) noexcept
: read_response_st_(diag, params.charset, 0u)
{
}

View File

@ -61,8 +61,8 @@ class start_execution_algo
}
public:
start_execution_algo(start_execution_algo_params params) noexcept
: read_head_st_(read_resultset_head_algo_params{params.diag, params.proc}), req_(params.req)
start_execution_algo(diagnostics& diag, start_execution_algo_params params) noexcept
: read_head_st_(diag, {params.proc}), req_(params.req)
{
}

View File

@ -39,7 +39,7 @@ static std::vector<std::uint8_t> expected_request()
struct fixture : algo_fixture_base
{
detail::run_pipeline_algo algo{detail::setup_close_statement_pipeline(st, {&diag, 3})};
detail::run_pipeline_algo algo{diag, detail::setup_close_statement_pipeline(st, {3})};
};
BOOST_AUTO_TEST_CASE(success)

View File

@ -43,7 +43,7 @@ static constexpr std::uint8_t serialized_select_1[] = {0x03, 0x53, 0x45, 0x4c, 0
struct read_response_fixture : algo_fixture_base
{
mock_execution_processor proc;
detail::read_execute_response_algo algo{&diag, &proc};
detail::read_execute_response_algo algo{diag, &proc};
read_response_fixture() { proc.sequence_number() = 42; }
};
@ -180,7 +180,7 @@ struct execute_fixture : algo_fixture_base
mock_execution_processor proc;
detail::execute_algo algo;
execute_fixture(any_execution_request req = {"SELECT 1"}) : algo({&diag, req, &proc}) {}
execute_fixture(any_execution_request req = {"SELECT 1"}) : algo(diag, {req, &proc}) {}
};
BOOST_AUTO_TEST_CASE(execute_success_eof)

View File

@ -31,7 +31,7 @@ BOOST_AUTO_TEST_SUITE(test_ping)
//
struct read_response_fixture : algo_fixture_base
{
detail::read_ping_response_algo algo{&diag, 57};
detail::read_ping_response_algo algo{diag, 57};
// Clearing diagnostics is not this algorithm's responsibility
read_response_fixture() : algo_fixture_base(diagnostics()) {}
@ -94,7 +94,7 @@ BOOST_AUTO_TEST_CASE(read_response_error_packet)
struct ping_fixture : algo_fixture_base
{
detail::run_pipeline_algo algo{detail::setup_ping_pipeline(st, {&diag})};
detail::run_pipeline_algo algo{diag, detail::setup_ping_pipeline(st)};
};
BOOST_AUTO_TEST_CASE(ping_success)

View File

@ -34,7 +34,7 @@ BOOST_AUTO_TEST_SUITE(test_prepare_statement)
//
struct read_response_fixture : algo_fixture_base
{
detail::read_prepare_statement_response_algo algo{&diag, 19};
detail::read_prepare_statement_response_algo algo{diag, 19};
// Clearing diagnostics is not this algorithm's responsibility
read_response_fixture() : algo_fixture_base(diagnostics()) {}
@ -160,9 +160,7 @@ BOOST_AUTO_TEST_CASE(read_response_error_packet)
//
struct prepare_fixture : algo_fixture_base
{
detail::prepare_statement_algo algo{
{&diag, "SELECT 1"}
};
detail::prepare_statement_algo algo{diag, {"SELECT 1"}};
statement result() const { return algo.result(st); }
};

View File

@ -38,9 +38,7 @@ BOOST_AUTO_TEST_SUITE(test_read_resultset_head)
struct fixture : algo_fixture_base
{
mock_execution_processor proc;
detail::read_resultset_head_algo algo{
{&diag, &proc}
};
detail::read_resultset_head_algo algo{diag, {&proc}};
fixture()
{

View File

@ -22,7 +22,6 @@
#include "test_unit/algo_test.hpp"
#include "test_unit/create_err.hpp"
#include "test_unit/create_execution_processor.hpp"
#include "test_unit/create_frame.hpp"
#include "test_unit/create_meta.hpp"
#include "test_unit/create_ok.hpp"
#include "test_unit/create_ok_frame.hpp"
@ -43,7 +42,8 @@ struct fixture : algo_fixture_base
mock_execution_processor proc;
std::array<row1, 3> storage;
detail::read_some_rows_algo algo{
{&diag, &proc, ref()}
diag,
{&proc, ref()}
};
output_ref ref() noexcept { return output_ref(span<row1>(storage), 0); }

View File

@ -34,9 +34,7 @@ BOOST_AUTO_TEST_SUITE(test_read_some_rows_dynamic)
struct fixture : algo_fixture_base
{
execution_state_impl exec_st;
detail::read_some_rows_dynamic_algo algo{
{&diag, &exec_st}
};
detail::read_some_rows_dynamic_algo algo{diag, {&exec_st}};
fixture()
{

View File

@ -33,7 +33,7 @@ BOOST_AUTO_TEST_SUITE(test_reset_connection)
//
struct read_response_fixture : algo_fixture_base
{
detail::read_reset_connection_response_algo algo{&diag, 11};
detail::read_reset_connection_response_algo algo{diag, 11};
// Clearing diagnostics is not this algorithm's responsibility
read_response_fixture() : algo_fixture_base(diagnostics()) {}
@ -99,7 +99,7 @@ BOOST_AUTO_TEST_CASE(read_response_error_packet)
//
struct reset_conn_fixture : algo_fixture_base
{
detail::run_pipeline_algo algo{detail::setup_reset_connection_pipeline(st, {&diag})};
detail::run_pipeline_algo algo{diag, detail::setup_reset_connection_pipeline(st)};
};
BOOST_AUTO_TEST_CASE(success)

View File

@ -67,7 +67,7 @@ struct fixture_base : algo_fixture_base
span<const std::uint8_t> req_buffer = mock_request,
std::vector<stage_response>* response = nullptr
)
: algo({&diag, req_buffer, stages, response})
: algo(diag, {req_buffer, stages, response})
{
}
};

View File

@ -76,7 +76,7 @@ struct read_response_fixture : algo_fixture_base
// Clearing diagnostics is not this algorithm's responsibility
read_response_fixture(character_set charset = utf8mb4_charset)
: algo_fixture_base(diagnostics()), algo({&diag, charset, 29})
: algo_fixture_base(diagnostics()), algo(diag, charset, 29)
{
}
};
@ -139,7 +139,7 @@ struct set_charset_fixture : algo_fixture_base
{
detail::set_character_set_algo algo;
set_charset_fixture(character_set charset = utf8mb4_charset) : algo({&diag, charset}) {}
set_charset_fixture(character_set charset = utf8mb4_charset) : algo(diag, {charset}) {}
};
BOOST_AUTO_TEST_CASE(set_charset_success)

View File

@ -19,7 +19,6 @@
#include <boost/test/unit_test.hpp>
#include "test_common/assert_buffer_equals.hpp"
#include "test_common/check_meta.hpp"
#include "test_common/create_basic.hpp"
#include "test_unit/algo_test.hpp"
@ -42,7 +41,7 @@ struct fixture : algo_fixture_base
mock_execution_processor proc;
detail::start_execution_algo algo;
fixture(any_execution_request req) : algo({&diag, req, &proc}) {}
fixture(any_execution_request req) : algo(diag, {req, &proc}) {}
};
BOOST_AUTO_TEST_CASE(text_query)