buffer_params.hpp 1.4 KB

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