prepared_statement.hxx
#ifndef PQXX_H_PREPARED_STATEMENT
#define PQXX_H_PREPARED_STATEMENT
#include "pqxx/compiler-public.hxx"
#include "pqxx/compiler-internal-pre.hxx"
#include "pqxx/types.hxx"
#include "pqxx/internal/statement_parameters.hxx"
namespace pqxx
{
namespace prepare
{
template<typename IT> inline pqxx::internal::dynamic_params<IT>
make_dynamic_params(IT begin, IT end)
{
return pqxx::internal::dynamic_params<IT>(begin, end);
}
template<typename C>
inline pqxx::internal::dynamic_params<typename C::const_iterator>
make_dynamic_params(const C &container)
{
return pqxx::internal::dynamic_params<typename C::const_iterator>(container);
}
} // namespace prepare
} // namespace pqxx
namespace pqxx
{
namespace prepare
{
class PQXX_LIBEXPORT invocation : internal::statement_parameters
{
public:
PQXX_DEPRECATED invocation(transaction_base &, const std::string &statement);
invocation &operator=(const invocation &) =delete;
result exec() const;
bool exists() const;
invocation &operator()() { add_param(); return *this; }
template<typename T> invocation &operator()(const T &v)
{ add_param(v, true); return *this; }
invocation &operator()(const binarystring &v)
{ add_binary_param(v, true); return *this; }
template<typename T> invocation &operator()(const T &v, bool nonnull)
{ add_param(v, nonnull); return *this; }
invocation &operator()(const binarystring &v, bool nonnull)
{ add_binary_param(v, nonnull); return *this; }
template<typename T> invocation &operator()(T *v, bool nonnull=true)
{ add_param(v, nonnull); return *this; }
invocation &operator()(const char *v, bool nonnull=true)
{ add_param(v, nonnull); return *this; }
private:
transaction_base &m_home;
const std::string m_statement;
invocation &setparam(const std::string &, bool nonnull);
};
namespace internal
{
struct PQXX_LIBEXPORT prepared_def
{
std::string definition;
bool registered = false;
prepared_def() =default;
explicit prepared_def(const std::string &);
};
} // namespace pqxx::prepare::internal
} // namespace pqxx::prepare
} // namespace pqxx
#include "pqxx/compiler-internal-post.hxx"
#endif
pqxx::prepare::invocation::operator()
invocation & operator()()
Pass null parameter.
Definition: prepared_statement.hxx:94
pqxx::internal
Private namespace for libpqxx's internal use; do not access.
Definition: connection_base.hxx:43
pqxx::result
Result set containing data returned by a query or command.
Definition: result.hxx:69
pqxx::prepare::internal::prepared_def::prepared_def
prepared_def()=default
pqxx::prepare::invocation
Helper class for passing parameters to, and executing, prepared statements.
Definition: prepared_statement.hxx:81
pqxx::prepare::make_dynamic_params
pqxx::internal::dynamic_params< IT > make_dynamic_params(IT begin, IT end)
Pass a number of statement parameters only known at runtime.
Definition: prepared_statement.hxx:44
pqxx::prepare::invocation::exec
result exec() const
Execute!
Definition: prepared_statement.cxx:34
pqxx::prepare::invocation::operator()
invocation & operator()(const binarystring &v, bool nonnull)
Pass binary parameter value for a BYTEA field.
Definition: prepared_statement.hxx:123
pqxx::prepare::invocation::operator()
invocation & operator()(const T &v)
Pass parameter value.
Definition: prepared_statement.hxx:100
pqxx::prepare::invocation::invocation
invocation(transaction_base &, const std::string &statement)
Definition: prepared_statement.cxx:25
pqxx::prepare::internal::prepared_def::definition
std::string definition
Text of prepared query.
Definition: prepared_statement.hxx:159
pqxx::binarystring
Binary data corresponding to PostgreSQL's "BYTEA" binary-string type.
Definition: binarystring.hxx:53
pqxx::prepare::invocation::exists
bool exists() const
Has a statement of this name been defined?
Definition: prepared_statement.cxx:50
pqxx::prepare::invocation::operator()
invocation & operator()(T *v, bool nonnull=true)
Pass C-style parameter string, or null if pointer is null.
Definition: prepared_statement.hxx:134
pqxx::prepare::invocation::operator()
invocation & operator()(const binarystring &v)
Pass binary parameter value for a BYTEA field.
Definition: prepared_statement.hxx:107
pqxx::prepare::invocation::operator()
invocation & operator()(const T &v, bool nonnull)
Pass parameter value.
Definition: prepared_statement.hxx:115
pqxx::prepare::internal::prepared_def
Internal representation of a prepared statement definition.
Definition: prepared_statement.hxx:156
pqxx::prepare::invocation::operator()
invocation & operator()(const char *v, bool nonnull=true)
Pass C-style string parameter, or null if pointer is null.
Definition: prepared_statement.hxx:142
pqxx::transaction_base
Interface definition (and common code) for "transaction" classes.
Definition: transaction_base.hxx:136
pqxx
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:25