pg_async
|
Asynchronous query class. More...
#include <query.hpp>
Public Member Functions | |
query (dbalias const &alias, std::string const &expression) | |
Construct a query. More... | |
template<typename... T> | |
query (dbalias const &alias, std::string const &expression, T const &...params) | |
Construct a prepared query with params to bind. More... | |
query (transaction_ptr tran, std::string const &expression) | |
Construct a query. More... | |
template<typename... T> | |
query (transaction_ptr tran, std::string const &expression, T const &...params) | |
Construct a prepared query with params to bind. More... | |
template<typename... T> | |
query & | bind (T const &...params) |
Bind parameters for the query. More... | |
query & | bind () |
Mark the query as prepared statement. More... | |
void | run_async (query_result_callback const &result, error_callback const &error) const |
Start running the query. More... | |
void | operator() (query_result_callback const &result, error_callback const &error) const |
Asynchronous query class.
Synopsis:
tip::db::pg::query::query | ( | dbalias const & | alias, |
std::string const & | expression | ||
) |
Construct a query.
Query will start a transaction in a connection with the alias.
alias | Database connection alias. |
expression | SQL query expression |
tip::db::pg::query::query | ( | dbalias const & | alias, |
std::string const & | expression, | ||
T const &... | params | ||
) |
tip::db::pg::query::query | ( | transaction_ptr | tran, |
std::string const & | expression | ||
) |
Construct a query.
tran | transaction object pointer |
expression | SQL query expression |
tip::db::pg::query::query | ( | transaction_ptr | tran, |
std::string const & | expression, | ||
T const &... | params | ||
) |
Construct a prepared query with params to bind.
tran | transaction object pointer |
expression | SQL query expression |
params | parameters to bind |
T | query parameter types |
query & tip::db::pg::query::bind | ( | T const &... | params | ) |
query& tip::db::pg::query::bind | ( | ) |
Mark the query as prepared statement.
void tip::db::pg::query::operator() | ( | query_result_callback const & | result, |
error_callback const & | error | ||
) | const |
Shortcut for tip::db::pg::query::run_async
result | result callback |
error | error callback |
void tip::db::pg::query::run_async | ( | query_result_callback const & | result, |
error_callback const & | error | ||
) | const |
Start running the query.
result | result callback |
error | error callback |