libpqxx
The C++ client library for PostgreSQL
|
Marker type: pass a dynamically-determined number of statement parameters. More...
Public Member Functions | |
constexpr | dynamic_params (IT begin, IT end) |
Wrap a sequence of pointers or iterators. | |
constexpr | dynamic_params (IT begin, IT end, ACCESSOR &acc) |
Wrap a sequence of pointers or iterators. | |
template<typename C > | |
constexpr | dynamic_params (C &container) |
Wrap a container. | |
template<typename C > | |
constexpr | dynamic_params (C &container, ACCESSOR &acc) |
Wrap a container. | |
constexpr IT | begin () const noexcept |
constexpr IT | end () const noexcept |
constexpr auto | access (decltype(*std::declval< IT >()) value) const -> decltype(std::declval< ACCESSOR >()(value)) |
Marker type: pass a dynamically-determined number of statement parameters.
Normally when invoking a prepared or parameterised statement, the number of parameters is known at compile time. For instance, t.exec_prepared("foo", 1, "x");
executes statement foo
with two parameters, an int
and a C string.
But sometimes you may want to pass a number of parameters known only at run time. In those cases, a dynamic_params encodes a dynamically determined number of parameters. You can mix these with regular, static parameter lists, and you can re-use them for multiple statement invocations.
A dynamic_params object does not store copies of its parameters, so make sure they remain accessible until you've executed the statement.
The ACCESSOR is an optional callable (such as a lambda). If you pass an accessor a
, then each parameter p
goes into your statement as a(p)
.
|
inlineconstexpr |
Wrap a sequence of pointers or iterators.
This version takes an accessor callable. If you pass an accessor acc
, then any parameter p
will go into the statement's parameter list as acc(p)
.
|
inlineexplicitconstexpr |
Wrap a container.
This version takes an accessor callable. If you pass an accessor acc
, then any parameter p
will go into the statement's parameter list as acc(p)
.