123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- #ifndef BOOST_MYSQL_STATIC_RESULTS_HPP
- #define BOOST_MYSQL_STATIC_RESULTS_HPP
- #include <boost/mysql/detail/config.hpp>
- #ifdef BOOST_MYSQL_CXX14
- #include <boost/mysql/metadata_collection_view.hpp>
- #include <boost/mysql/string_view.hpp>
- #include <boost/mysql/underlying_row.hpp>
- #include <boost/mysql/detail/access.hpp>
- #include <boost/mysql/detail/execution_processor/static_results_impl.hpp>
- #include <boost/assert.hpp>
- namespace boost {
- namespace mysql {
- template <class... StaticRow>
- class static_results
- {
- public:
-
- static_results() = default;
-
- static_results(const static_results& other) = default;
-
- static_results(static_results&& other) = default;
-
- static_results& operator=(const static_results& other) = default;
-
- static_results& operator=(static_results&& other) = default;
-
- ~static_results() = default;
-
- bool has_value() const noexcept { return impl_.get_interface().is_complete(); }
-
- template <std::size_t I = 0>
- #ifdef BOOST_MYSQL_DOXYGEN
- boost::span<const StaticRow... [I]>
- #else
- detail::rows_span_t<I, StaticRow...>
- #endif
- rows() const noexcept {
- static_assert(I < sizeof...(StaticRow), "Index I out of range");
- BOOST_ASSERT(has_value());
- return impl_.template get_rows<I>();
- }
-
- template <std::size_t I = 0>
- metadata_collection_view meta() const noexcept
- {
- static_assert(I < sizeof...(StaticRow), "Index I out of range");
- BOOST_ASSERT(has_value());
- return impl_.get_interface().get_meta(I);
- }
-
- template <std::size_t I = 0>
- std::uint64_t affected_rows() const noexcept
- {
- static_assert(I < sizeof...(StaticRow), "Index I out of range");
- BOOST_ASSERT(has_value());
- return impl_.get_interface().get_affected_rows(I);
- }
-
- template <std::size_t I = 0>
- std::uint64_t last_insert_id() const noexcept
- {
- static_assert(I < sizeof...(StaticRow), "I index out of range");
- BOOST_ASSERT(has_value());
- return impl_.get_interface().get_last_insert_id(I);
- }
-
- template <std::size_t I = 0>
- unsigned warning_count() const noexcept
- {
- static_assert(I < sizeof...(StaticRow), "I index out of range");
- BOOST_ASSERT(has_value());
- return impl_.get_interface().get_warning_count(I);
- }
-
- template <std::size_t I = 0>
- string_view info() const noexcept
- {
- static_assert(I < sizeof...(StaticRow), "I index out of range");
- BOOST_ASSERT(has_value());
- return impl_.get_interface().get_info(I);
- }
- private:
- detail::static_results_impl<StaticRow...> impl_;
- #ifndef BOOST_MYSQL_DOXYGEN
- friend struct detail::access;
- #endif
- };
- }
- }
- #endif
- #endif
|