123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- #ifndef BOOST_MYSQL_RESULTSET_VIEW_HPP
- #define BOOST_MYSQL_RESULTSET_VIEW_HPP
- #include <boost/mysql/metadata_collection_view.hpp>
- #include <boost/mysql/rows_view.hpp>
- #include <boost/mysql/detail/access.hpp>
- #include <boost/mysql/detail/execution_processor/results_impl.hpp>
- #include <boost/assert.hpp>
- namespace boost {
- namespace mysql {
- class resultset_view
- {
- public:
-
- resultset_view() = default;
-
- bool has_value() const noexcept { return impl_ != nullptr; }
-
- rows_view rows() const noexcept
- {
- BOOST_ASSERT(has_value());
- return impl_->get_rows(index_);
- }
-
- metadata_collection_view meta() const noexcept
- {
- BOOST_ASSERT(has_value());
- return impl_->get_meta(index_);
- }
-
- std::uint64_t affected_rows() const noexcept
- {
- BOOST_ASSERT(has_value());
- return impl_->get_affected_rows(index_);
- }
-
- std::uint64_t last_insert_id() const noexcept
- {
- BOOST_ASSERT(has_value());
- return impl_->get_last_insert_id(index_);
- }
-
- unsigned warning_count() const noexcept
- {
- BOOST_ASSERT(has_value());
- return impl_->get_warning_count(index_);
- }
-
- string_view info() const noexcept
- {
- BOOST_ASSERT(has_value());
- return impl_->get_info(index_);
- }
-
- bool is_out_params() const noexcept
- {
- BOOST_ASSERT(has_value());
- return impl_->get_is_out_params(index_);
- }
- #ifndef BOOST_MYSQL_DOXYGEN
- const resultset_view* operator->() const noexcept { return this; }
- #endif
- private:
- const detail::results_impl* impl_{};
- std::size_t index_{};
- resultset_view(const detail::results_impl& impl, std::size_t index) noexcept : impl_(&impl), index_(index)
- {
- }
- #ifndef BOOST_MYSQL_DOXYGEN
- friend struct detail::access;
- #endif
- };
- }
- }
- #endif
|