buffer_params.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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_BUFFER_PARAMS_HPP
  8. #define BOOST_MYSQL_BUFFER_PARAMS_HPP
  9. #include <boost/mysql/defaults.hpp>
  10. #include <cstddef>
  11. namespace boost {
  12. namespace mysql {
  13. /**
  14. * \brief Buffer configuration parameters for a connection.
  15. */
  16. class buffer_params
  17. {
  18. std::size_t initial_read_size_;
  19. public:
  20. /// The default value of \ref initial_read_size.
  21. static constexpr std::size_t default_initial_read_size = default_initial_read_buffer_size;
  22. /**
  23. * \brief Initializing constructor.
  24. * \param initial_read_size Initial size of the read buffer. A bigger read buffer
  25. * can increase the number of rows returned by \ref connection::read_some_rows.
  26. */
  27. constexpr explicit buffer_params(std::size_t initial_read_size = default_initial_read_size) noexcept
  28. : initial_read_size_(initial_read_size)
  29. {
  30. }
  31. /// Gets the initial size of the read buffer.
  32. constexpr std::size_t initial_read_size() const noexcept { return initial_read_size_; }
  33. /// Sets the initial size of the read buffer.
  34. void set_initial_read_size(std::size_t v) noexcept { initial_read_size_ = v; }
  35. };
  36. } // namespace mysql
  37. } // namespace boost
  38. #endif