// // Copyright (c) 2019-2025 Ruben Perez Hidalgo (rubenperez038 at gmail dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #ifndef BOOST_MYSQL_IMPL_WITH_PARAMS_HPP #define BOOST_MYSQL_IMPL_WITH_PARAMS_HPP #pragma once #include #include #include #include #include #include #include #include // Execution request traits namespace boost { namespace mysql { namespace detail { template struct with_params_proxy { constant_string_view query; std::array args; operator detail::any_execution_request() const { return any_execution_request({query, args}); } }; template struct execution_request_traits> { template static with_params_proxy make_request_impl(WithParamsType&& input, mp11::index_sequence) { boost::ignore_unused(input); // MSVC gets confused for tuples of size 0 // clang-format off return { input.query, {{ { string_view(), formattable_ref(std::get(std::forward(input).args)) }... }} }; // clang-format on } // Allow the value category of the object to be deduced template static with_params_proxy make_request(WithParamsType&& input, std::vector&) { return make_request_impl( std::forward(input), mp11::make_index_sequence() ); } }; // Old MSVCs fail to process the above when sizeof...(T) is zero template <> struct execution_request_traits> { static any_execution_request make_request(with_params_t<> input, std::vector&) { return any_execution_request({input.query, span{}}); } }; } // namespace detail } // namespace mysql } // namespace boost #endif