libpqxx
pqxx::prepare Namespace Reference

Dedicated namespace for helper types related to prepared statements. More...

Namespaces

 internal
 

Classes

class  invocation
 Helper class for passing parameters to, and executing, prepared statements. More...
 

Functions

template<typename IT >
pqxx::internal::dynamic_params< IT > make_dynamic_params (IT begin, IT end)
 Pass a number of statement parameters only known at runtime. More...
 
template<typename C >
pqxx::internal::dynamic_params< typename C::const_iterator > make_dynamic_params (const C &container)
 Pass a number of statement parameters only known at runtime. More...
 

Detailed Description

Dedicated namespace for helper types related to prepared statements.

Function Documentation

◆ make_dynamic_params() [1/2]

template<typename IT >
pqxx::internal::dynamic_params<IT> pqxx::prepare::make_dynamic_params ( IT  begin,
IT  end 
)

Pass a number of statement parameters only known at runtime.

When you call any of the exec_params functions, the number of arguments is normally known at compile time. This helper function supports the case where it is not.

Use this function to pass a variable number of parameters, based on a sequence ranging from begin to end exclusively.

The technique combines with the regular static parameters. You can use it to insert dynamic parameter lists in any place, or places, among the call's parameters. You can even insert multiple dynamic sequences.

Parameters
beginA pointer or iterator for iterating parameters.
endA pointer or iterator for iterating parameters.
Returns
An object representing the parameters.

◆ make_dynamic_params() [2/2]

template<typename C >
pqxx::internal::dynamic_params<typename C::const_iterator> pqxx::prepare::make_dynamic_params ( const C &  container)

Pass a number of statement parameters only known at runtime.

When you call any of the exec_params functions, the number of arguments is normally known at compile time. This helper function supports the case where it is not.

Use this function to pass a variable number of parameters, based on a container of parameter values.

The technique combines with the regular static parameters. You can use it to insert dynamic parameter lists in any place, or places, among the call's parameters. You can even insert multiple dynamic containers.

Parameters
containerA container of parameter values.
Returns
An object representing the parameters.