libpqxx
The C++ client library for PostgreSQL
pqxx::internal::basic_robusttransaction Class Referenceabstract

Helper base class for the pqxx::robusttransaction class template. More...

#include <robusttransaction.hxx>

+ Inheritance diagram for pqxx::internal::basic_robusttransaction:
+ Collaboration diagram for pqxx::internal::basic_robusttransaction:

Public Member Functions

 basic_robusttransaction (basic_robusttransaction const &)=delete
 
 basic_robusttransaction (basic_robusttransaction &&)=delete
 
 ~basic_robusttransaction () override=0
 
basic_robusttransactionoperator= (basic_robusttransaction const &)=delete
 
basic_robusttransactionoperator= (basic_robusttransaction &&)=delete
 
- Public Member Functions inherited from pqxx::dbtransaction
 dbtransaction ()=delete
 
- Public Member Functions inherited from pqxx::transaction_base
 transaction_base ()=delete
 
 transaction_base (transaction_base const &)=delete
 
 transaction_base (transaction_base &&)=delete
 
transaction_baseoperator= (transaction_base const &)=delete
 
transaction_baseoperator= (transaction_base &&)=delete
 
virtual ~transaction_base ()=0
 
void commit (sl=sl::current())
 Commit the transaction. More...
 
void abort (sl=sl::current())
 Abort the transaction. More...
 
PQXX_ZARGS std::string esc (char const str[], sl loc=sl::current())
 
std::string_view esc (std::string_view text, std::span< char > buffer, sl loc=sl::current()) const
 Escape string for use as SQL string literal in this transaction. More...
 
std::string esc (std::string_view text, sl loc=sl::current()) const
 Escape string for use as SQL string literal in this transaction. More...
 
template<binary DATA>
std::string esc (DATA const &data) const
 Escape binary string for use as SQL string literal. More...
 
template<binary DATA>
zview esc (DATA const &data, std::span< char > buffer, sl loc=sl::current()) const
 Escape binary string for use as SQL string literal, into buffer. More...
 
template<binary DATA>
zview esc_raw (DATA const &data, sl loc=sl::current()) const
 Escape binary string for use as SQL string literal, into buffer. More...
 
template<binary DATA>
zview esc_raw (DATA const &data, std::span< char > buffer, sl loc=sl::current()) const
 Escape binary string for use as SQL string literal, into buffer. More...
 
bytes unesc_bin (zview text, sl loc=sl::current())
 Unescape binary data, e.g. from a bytea field. More...
 
PQXX_ZARGS bytes unesc_bin (char const text[], sl loc=sl::current())
 Unescape binary data, e.g. from a bytea field. More...
 
template<typename T >
std::string quote (T const &t, sl loc=sl::current()) const
 Represent object as SQL string, including quoting & escaping. More...
 
template<binary DATA>
std::string quote_raw (DATA const &data, sl loc=sl::current()) const
 Binary-escape and quote a binary string for use as an SQL constant. More...
 
std::string quote_name (std::string_view identifier) const
 Escape an SQL identifier for use in a query. More...
 
std::string esc_like (std::string_view bin, char escape_char='\\', sl loc=sl::current()) const
 Escape string for literal LIKE match. More...
 
result exec (std::string_view query, std::string_view desc, sl=sl::current())
 Execute a command. More...
 
result exec (std::string_view query, params const &parms, sl loc=sl::current())
 
result exec (std::string_view query, sl=sl::current())
 Execute a command. More...
 
result exec (std::stringstream const &query, std::string_view desc)
 Execute a command. More...
 
result exec0 (std::string_view query, std::string_view desc)
 Execute command, which should return zero rows of data. More...
 
result exec0 (std::string_view query)
 Execute command, which should return zero rows of data. More...
 
row exec1 (std::string_view query, std::string_view desc)
 Execute command returning a single row of data. More...
 
row exec1 (std::string_view query)
 Execute command returning a single row of data. More...
 
result exec_n (result::size_type rows, std::string_view query, std::string_view desc)
 Execute command, expect given number of rows. More...
 
result exec_n (result::size_type rows, std::string_view query)
 Execute command, expect given number of rows. More...
 
template<not_borrowed TYPE>
TYPE query_value (std::string_view query, std::string_view desc)
 Perform query, expecting exactly 1 row with 1 field, and convert it. More...
 
template<not_borrowed TYPE>
TYPE query_value (std::string_view query, sl loc=sl::current())
 Perform query, expecting exactly 1 row with 1 field, and convert it. More...
 
template<not_borrowed... TYPE>
std::tuple< TYPE... > query1 (std::string_view query, sl loc=sl::current())
 Perform query returning exactly one row, and convert its fields. More...
 
template<not_borrowed... TYPE>
std::optional< std::tuple< TYPE... > > query01 (std::string_view query, sl loc=sl::current())
 Query at most one row of data, and if there is one, convert it. More...
 
template<std::move_constructible... TYPE>
auto stream (std::string_view query, sl loc=sl::current()) &
 Execute a query, in streaming fashion; loop over the results row by row. More...
 
template<typename CALLABLE >
auto for_stream (std::string_view query, CALLABLE &&func, sl loc=sl::current())
 Perform a streaming query, and for each result row, call func. More...
 
template<typename CALLABLE >
auto for_each (std::string_view query, CALLABLE &&func, sl loc=sl::current())
 
template<typename... TYPE>
auto query (std::string_view query, sl loc=sl::current())
 Execute query, read full results, then iterate rows of data. More...
 
template<typename... TYPE>
auto query_n (result::size_type rows, std::string_view query, sl loc=sl::current())
 Perform query, expect given number of rows, iterate results. More...
 
template<typename CALLABLE >
void for_query (std::string_view query, CALLABLE &&func, sl loc=sl::current())
 Execute a query, load the full result, and perform func for each row. More...
 
template<typename... Args>
result exec_params (std::string_view query, Args &&...args)
 Execute an SQL statement with parameters. More...
 
template<typename... Args>
row exec_params1 (std::string_view query, Args &&...args)
 
template<typename... Args>
result exec_params0 (std::string_view query, Args &&...args)
 
template<typename... Args>
result exec_params_n (std::size_t rows, std::string_view query, Args &&...args)
 
template<typename... Args>
result exec_params_n (result::size_type rows, std::string_view query, Args &&...args)
 
template<typename... TYPE>
auto query (std::string_view query, params const &parms, sl loc=sl::current())
 Execute parameterised query, read full results, iterate rows of data. More...
 
template<typename... TYPE>
auto query_n (result::size_type rows, std::string_view query, params const &parms)
 
template<not_borrowed TYPE>
TYPE query_value (std::string_view query, params const &parms, sl loc=sl::current())
 Perform query, expecting exactly 1 row with 1 field, and convert it. More...
 
template<not_borrowed... TYPE>
std::tuple< TYPE... > query1 (std::string_view query, params const &parms, sl loc=sl::current())
 Perform query returning exactly one row, and convert its fields. More...
 
template<not_borrowed... TYPE>
std::optional< std::tuple< TYPE... > > query01 (std::string_view query, params const &parms, sl loc=sl::current())
 Query at most one row of data, and if there is one, convert it. More...
 
template<typename CALLABLE >
void for_query (std::string_view query, CALLABLE &&func, params const &parms, sl loc=sl::current())
 Execute a query, load the full result, and perform func for each row. More...
 
void notify (std::string_view channel, std::string_view payload, sl=sl::current())
 Send a notification. More...
 
void notify (std::string_view channel, sl loc=sl::current())
 Send a notification (without payload). More...
 
template<typename... Args>
result exec_prepared (zview statement, Args &&...args)
 Execute a prepared statement, with optional arguments. More...
 
result exec (prepped statement, sl loc=sl::current())
 Execute a prepared statement taking no parameters. More...
 
template<typename... TYPE>
auto query (prepped statement, params const &parms, sl loc=sl::current())
 Execute prepared statement, read full results, iterate rows of data. More...
 
template<typename... TYPE>
auto query (prepped statement, sl loc=sl::current())
 Execute prepared statement, read full results, iterate rows of data. More...
 
template<not_borrowed TYPE>
TYPE query_value (prepped statement, params const &parms, sl loc=sl::current())
 Perform prepared statement returning exactly 1 value. More...
 
template<not_borrowed TYPE>
TYPE query_value (prepped statement, sl loc=sl::current())
 Perform prepared statement returning exactly 1 value. More...
 
template<typename CALLABLE >
void for_query (prepped statement, CALLABLE &&func, params const &parms, sl loc=sl::current())
 Execute prepared statement, load result, perform func for each row. More...
 
template<typename CALLABLE >
void for_query (prepped statement, CALLABLE &&func, sl loc=sl::current())
 Execute prepared statement, load result, perform func for each row. More...
 
result exec (prepped statement, params const &parms, sl loc=sl::current())
 Execute a prepared statement with parameters. More...
 
template<typename... Args>
row exec_prepared1 (zview statement, Args &&...args)
 Execute a prepared statement, and expect a single-row result. More...
 
template<typename... Args>
result exec_prepared0 (zview statement, Args &&...args)
 Execute a prepared statement, and expect a result with zero rows. More...
 
template<typename... Args>
result exec_prepared_n (result::size_type rows, zview statement, Args &&...args)
 Execute a prepared statement, expect a result with given number of rows. More...
 
PQXX_ZARGS void process_notice (char const msg[]) const
 Have connection process a warning message. More...
 
void process_notice (zview msg) const
 Have connection process a warning message. More...
 
constexpr connectionconn () const noexcept
 The connection in which this transaction lives. More...
 
void set_variable (std::string_view var, std::string_view value)
 Set session variable using SQL "SET" command. More...
 
std::string get_variable (std::string_view)
 Read session variable using SQL "SHOW" command. More...
 
constexpr std::string_view name () const &noexcept
 Transaction name, if you passed one to the constructor; or empty string. More...
 

Protected Member Functions

 basic_robusttransaction (connection &cx, zview begin_command, sl)
 
- Protected Member Functions inherited from pqxx::dbtransaction
 dbtransaction (connection &cx, sl loc=sl::current())
 Begin transaction. More...
 
 dbtransaction (connection &cx, std::string_view tname, sl loc=sl::current())
 Begin transaction. More...
 
 dbtransaction (connection &cx, std::string_view tname, std::shared_ptr< std::string > rollback_cmd, sl loc=sl::current())
 Begin transaction. More...
 
- Protected Member Functions inherited from pqxx::transaction_base
 transaction_base (connection &, std::string_view, std::shared_ptr< std::string > rollback_cmd, sl loc=sl::current())
 Create a transaction (to be called by implementation classes only). More...
 
 transaction_base (connection &cx, std::string_view tname, sl loc=sl::current())
 Create a transaction (to be called by implementation classes only). More...
 
 transaction_base (connection &cx, sl loc=sl::current())
 Create a transaction (to be called by implementation classes only). More...
 
void register_transaction ()
 Register this transaction with the connection. More...
 
void close (sl=sl::current()) noexcept
 End transaction. To be called by implementing class' destructor. More...
 
virtual void do_abort (sl)
 Transaction type-specific way of aborting a transaction. More...
 
void set_rollback_cmd (std::shared_ptr< std::string > cmd)
 Set the rollback command. More...
 
result direct_exec (std::string_view, std::string_view desc, sl)
 Execute query on connection directly. More...
 
result direct_exec (std::string_view query, sl loc)
 
result direct_exec (std::shared_ptr< std::string >, std::string_view desc, sl)
 
result direct_exec (std::shared_ptr< std::string > query, sl loc)
 
sl created_loc () const
 The std::source_location for this transaction's creation. More...
 

Detailed Description

Helper base class for the pqxx::robusttransaction class template.

Constructor & Destructor Documentation

◆ basic_robusttransaction() [1/3]

pqxx::internal::basic_robusttransaction::basic_robusttransaction ( basic_robusttransaction const &  )
delete

◆ basic_robusttransaction() [2/3]

pqxx::internal::basic_robusttransaction::basic_robusttransaction ( basic_robusttransaction &&  )
delete

◆ ~basic_robusttransaction()

pqxx::internal::basic_robusttransaction::~basic_robusttransaction ( )
overridepure virtualdefault

◆ basic_robusttransaction() [3/3]

pqxx::internal::basic_robusttransaction::basic_robusttransaction ( connection cx,
zview  begin_command,
sl  loc 
)
protected

Member Function Documentation

◆ operator=() [1/2]

basic_robusttransaction& pqxx::internal::basic_robusttransaction::operator= ( basic_robusttransaction &&  )
delete

◆ operator=() [2/2]

basic_robusttransaction& pqxx::internal::basic_robusttransaction::operator= ( basic_robusttransaction const &  )
delete

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