Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext
format_sql (2 of 2 overloads)

(EXPERIMENTAL) Composes a SQL query client-side.

Synopsis

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

std::string
format_sql(
    const format_options& opts,
    constant_string_view format_str,
    std::initializer_list< format_arg > args);
Description

Parses format_str as a format string, substituting replacement fields (like {}, {1} or {name}) by formatted arguments, extracted from args. opts is using to parse the string and format string arguments.

Formatting is performed as if format_context::append_raw and format_context::append_value were called on a context created by this function.

Exception safety

Strong guarantee. Memory allocations may throw. boost::system::system_error is thrown if an error is found while formatting. See below for more info.

Errors

This overload allows using named arguments.

Convenience header <boost/mysql.hpp>


PrevUpHomeNext