close_statement.hpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //
  2. // Copyright (c) 2019-2024 Ruben Perez Hidalgo (rubenperez038 at gmail dot com)
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. #ifndef BOOST_MYSQL_IMPL_INTERNAL_SANSIO_CLOSE_STATEMENT_HPP
  8. #define BOOST_MYSQL_IMPL_INTERNAL_SANSIO_CLOSE_STATEMENT_HPP
  9. #include <boost/mysql/detail/algo_params.hpp>
  10. #include <boost/mysql/impl/internal/protocol/serialization.hpp>
  11. #include <boost/mysql/impl/internal/sansio/connection_state_data.hpp>
  12. namespace boost {
  13. namespace mysql {
  14. namespace detail {
  15. inline run_pipeline_algo_params setup_close_statement_pipeline(
  16. connection_state_data& st,
  17. close_statement_algo_params params
  18. )
  19. {
  20. st.write_buffer.clear();
  21. auto seqnum1 = serialize_top_level(close_stmt_command{params.stmt_id}, st.write_buffer);
  22. auto seqnum2 = serialize_top_level(ping_command{}, st.write_buffer);
  23. st.shared_pipeline_stages = {
  24. {{pipeline_stage_kind::close_statement, seqnum1, {}}, {pipeline_stage_kind::ping, seqnum2, {}}}
  25. };
  26. return {params.diag, st.write_buffer, st.shared_pipeline_stages, nullptr};
  27. }
  28. } // namespace detail
  29. } // namespace mysql
  30. } // namespace boost
  31. #endif