Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

with_params

Creates a query with parameters (client-side SQL formatting) that can be executed.

Synopsis

Defined in header <boost/mysql/with_params.hpp>

template<
    class... FormattableOrRefWrapper>
auto
with_params(
    constant_string_view query,
    FormattableOrRefWrapper&&... args);
Description

Creates a with_params_t object by packing the supplied arguments into a tuple, calling std::make_tuple. As per std::make_tuple, parameters will be decay-copied into the resulting object. This behavior can be disabled by passing std::reference_wrapper objects, which are transformed into references.

This function does not inspect the supplied query string and arguments. Errors like missing format arguments are detected when the resulting object is executed. This function does not involve communication with the server.

The passed args must either satisfy Formattable, or be std::reference_wrapper<T> with T satisfying Formattable.

See with_params_t for details on how the execution request works.

Exception safety

Strong guarantee. Any exception thrown when copying args will be propagated.

Convenience header <boost/mysql.hpp>


PrevUpHomeNext