libpqxx
The C++ client library for PostgreSQL
Loading...
Searching...
No Matches
pqxx::internal::dynamic_params< IT, ACCESSOR > Class Template Reference

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))
 

Detailed Description

template<typename IT, typename ACCESSOR = decltype(iterator_identity<IT>)>
class pqxx::internal::dynamic_params< IT, ACCESSOR >

Marker type: pass a dynamically-determined number of statement parameters.

Deprecated:
Use params instead.

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).

Constructor & Destructor Documentation

◆ dynamic_params() [1/2]

template<typename IT , typename ACCESSOR = decltype(iterator_identity<IT>)>
constexpr pqxx::internal::dynamic_params< IT, ACCESSOR >::dynamic_params ( IT  begin,
IT  end,
ACCESSOR &  acc 
)
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).

◆ dynamic_params() [2/2]

template<typename IT , typename ACCESSOR = decltype(iterator_identity<IT>)>
template<typename C >
constexpr pqxx::internal::dynamic_params< IT, ACCESSOR >::dynamic_params ( C &  container,
ACCESSOR &  acc 
)
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).


The documentation for this class was generated from the following file: