File indexing completed on 2025-04-19 08:33:52
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_MYSQL_IMPL_INTERNAL_SANSIO_RESET_CONNECTION_HPP
0009 #define BOOST_MYSQL_IMPL_INTERNAL_SANSIO_RESET_CONNECTION_HPP
0010
0011 #include <boost/mysql/diagnostics.hpp>
0012 #include <boost/mysql/error_code.hpp>
0013
0014 #include <boost/mysql/detail/algo_params.hpp>
0015
0016 #include <boost/mysql/impl/internal/coroutine.hpp>
0017 #include <boost/mysql/impl/internal/protocol/deserialization.hpp>
0018 #include <boost/mysql/impl/internal/protocol/serialization.hpp>
0019 #include <boost/mysql/impl/internal/sansio/connection_state_data.hpp>
0020
0021 namespace boost {
0022 namespace mysql {
0023 namespace detail {
0024
0025 class read_reset_connection_response_algo
0026 {
0027 int resume_point_{0};
0028 diagnostics* diag_;
0029 std::uint8_t seqnum_{0};
0030
0031 public:
0032 read_reset_connection_response_algo(diagnostics* diag, std::uint8_t seqnum) noexcept
0033 : diag_(diag), seqnum_(seqnum)
0034 {
0035 }
0036
0037 next_action resume(connection_state_data& st, error_code ec)
0038 {
0039 switch (resume_point_)
0040 {
0041 case 0:
0042
0043
0044 BOOST_MYSQL_YIELD(resume_point_, 1, st.read(seqnum_))
0045 if (ec)
0046 return ec;
0047
0048
0049 ec = st.deserialize_ok(*diag_);
0050 if (!ec)
0051 {
0052
0053
0054
0055 st.current_charset = character_set{};
0056 }
0057
0058
0059 return ec;
0060 }
0061
0062 return next_action();
0063 }
0064 };
0065
0066 inline run_pipeline_algo_params setup_reset_connection_pipeline(
0067 connection_state_data& st,
0068 reset_connection_algo_params params
0069 )
0070 {
0071 st.write_buffer.clear();
0072 st.shared_pipeline_stages[0] = {
0073 pipeline_stage_kind::reset_connection,
0074 serialize_top_level(reset_connection_command{}, st.write_buffer),
0075 {}
0076 };
0077 return {
0078 params.diag,
0079 st.write_buffer,
0080 {st.shared_pipeline_stages.data(), 1},
0081 nullptr
0082 };
0083 }
0084
0085 }
0086 }
0087 }
0088
0089 #endif