algo_params.hpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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_DETAIL_ALGO_PARAMS_HPP
  8. #define BOOST_MYSQL_DETAIL_ALGO_PARAMS_HPP
  9. #include <boost/mysql/character_set.hpp>
  10. #include <boost/mysql/diagnostics.hpp>
  11. #include <boost/mysql/handshake_params.hpp>
  12. #include <boost/mysql/rows_view.hpp>
  13. #include <boost/mysql/statement.hpp>
  14. #include <boost/mysql/string_view.hpp>
  15. #include <boost/mysql/detail/any_execution_request.hpp>
  16. #include <boost/mysql/detail/execution_processor/execution_processor.hpp>
  17. #include <boost/mysql/detail/execution_processor/execution_state_impl.hpp>
  18. #include <cstddef>
  19. #include <cstdint>
  20. namespace boost {
  21. namespace mysql {
  22. namespace detail {
  23. struct connect_algo_params
  24. {
  25. diagnostics* diag;
  26. handshake_params hparams;
  27. bool secure_channel; // Are we using UNIX sockets or any other secure channel?
  28. using result_type = void;
  29. };
  30. struct handshake_algo_params
  31. {
  32. diagnostics* diag;
  33. handshake_params hparams;
  34. bool secure_channel; // Are we using UNIX sockets or any other secure channel?
  35. using result_type = void;
  36. };
  37. struct execute_algo_params
  38. {
  39. diagnostics* diag;
  40. any_execution_request req;
  41. execution_processor* proc;
  42. using result_type = void;
  43. };
  44. struct start_execution_algo_params
  45. {
  46. diagnostics* diag;
  47. any_execution_request req;
  48. execution_processor* proc;
  49. using result_type = void;
  50. };
  51. struct read_resultset_head_algo_params
  52. {
  53. diagnostics* diag;
  54. execution_processor* proc;
  55. using result_type = void;
  56. };
  57. struct read_some_rows_algo_params
  58. {
  59. diagnostics* diag;
  60. execution_processor* proc;
  61. output_ref output;
  62. using result_type = std::size_t;
  63. };
  64. struct read_some_rows_dynamic_algo_params
  65. {
  66. diagnostics* diag;
  67. execution_state_impl* exec_st;
  68. using result_type = rows_view;
  69. };
  70. struct prepare_statement_algo_params
  71. {
  72. diagnostics* diag;
  73. string_view stmt_sql;
  74. using result_type = statement;
  75. };
  76. struct close_statement_algo_params
  77. {
  78. diagnostics* diag;
  79. std::uint32_t stmt_id;
  80. using result_type = void;
  81. };
  82. struct ping_algo_params
  83. {
  84. diagnostics* diag;
  85. using result_type = void;
  86. };
  87. struct reset_connection_algo_params
  88. {
  89. diagnostics* diag;
  90. character_set charset; // set a non-empty character set to pipeline a SET NAMES with the reset request
  91. using result_type = void;
  92. };
  93. struct set_character_set_algo_params
  94. {
  95. diagnostics* diag;
  96. character_set charset;
  97. using result_type = void;
  98. };
  99. struct quit_connection_algo_params
  100. {
  101. diagnostics* diag;
  102. using result_type = void;
  103. };
  104. struct close_connection_algo_params
  105. {
  106. diagnostics* diag;
  107. using result_type = void;
  108. };
  109. template <class AlgoParams>
  110. constexpr bool has_void_result() noexcept
  111. {
  112. return std::is_same<typename AlgoParams::result_type, void>::value;
  113. }
  114. } // namespace detail
  115. } // namespace mysql
  116. } // namespace boost
  117. #endif