Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

formatter

(EXPERIMENTAL) An extension point to customize SQL formatting.

Synopsis

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

template<
    class T>
struct formatter
Description

This type can be specialized for custom types to make them formattable. This makes them satisfy the Formattable concept, and usable in format_sql and format_context_base::append_value.

A formatter specialization for a type T should have the following form:

template <> struct formatter<MyType> {
    static void format( const MyType&, format_context_base&);
}

Don't specialize formatter for built-in types, like int, std::string or optionals (formally, any type satisfying WritableField). This is not supported and will result in a compile-time error.

Convenience header <boost/mysql.hpp>


PrevUpHomeNext