buffer_params.hpp 1.3 KB

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