buffer_params.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // Copyright (c) 2019-2025 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_BUFFER_PARAMS_HPP
  8. #define BOOST_MYSQL_BUFFER_PARAMS_HPP
  9. #include <boost/mysql/defaults.hpp>
  10. #include <boost/config.hpp>
  11. #include <cstddef>
  12. namespace boost {
  13. namespace mysql {
  14. /**
  15. * \brief (Legacy) Buffer configuration parameters for a connection.
  16. *
  17. * \par Legacy
  18. * This class is used with the legacy \ref connection class.
  19. * New code should use \ref any_connection, instead.
  20. * The equivalent to `buffer_params` is \ref any_connection_params::initial_buffer_size.
  21. */
  22. class buffer_params
  23. {
  24. std::size_t initial_read_size_;
  25. public:
  26. /// The default value of \ref initial_read_size.
  27. static BOOST_INLINE_CONSTEXPR std::size_t default_initial_read_size = default_initial_read_buffer_size;
  28. /**
  29. * \brief Initializing constructor.
  30. * \param initial_read_size Initial size of the read buffer. A bigger read buffer
  31. * can increase the number of rows returned by \ref connection::read_some_rows.
  32. */
  33. constexpr explicit buffer_params(std::size_t initial_read_size = default_initial_read_size) noexcept
  34. : initial_read_size_(initial_read_size)
  35. {
  36. }
  37. /// Gets the initial size of the read buffer.
  38. constexpr std::size_t initial_read_size() const noexcept { return initial_read_size_; }
  39. /// Sets the initial size of the read buffer.
  40. void set_initial_read_size(std::size_t v) noexcept { initial_read_size_ = v; }
  41. };
  42. } // namespace mysql
  43. } // namespace boost
  44. #endif