Query-related functions.
Functions | |
| template<typename BinaryQueryConvertible , typename OidMap , typename Allocator = std::allocator<char>> | |
| binary_query | ozo::to_binary_query (const BinaryQueryConvertible &query, const OidMap &oid_map, const Allocator &allocator=Allocator{}) |
| Convert a query object to the binary representation. More... | |
| template<typename T > | |
| constexpr auto | ozo::to_const_char (const T &text) noexcept |
| Convert QueryText to const char*. More... | |
| template<typename Query > | |
| constexpr auto | ozo::get_query_text (Query &&query) |
| Get the query text object. More... | |
| template<typename T > | |
| constexpr auto | ozo::get_query_params (Query &&query) |
| Get the query parameters. More... | |
| template<class QueryText , class ... Params> | |
| constexpr auto | ozo::make_query (QueryText &&text, Params &&...params) |
| Construct built-in Query implementation object. More... | |
|
constexpr |
Get the query parameters.
Provides read-only access to query parameters. This function invokes ozo::get_query_params_impl::apply() and should be customized via ozo::get_query_params_impl specialization.
This is one of two points (see also ozo::get_query_text()) which should be used to support your own query type in the library. E.g.:
| query | — query object |
|
constexpr |
Get the query text object.
Provides read-only access to a query text with SQL statement. This function invokes ozo::get_query_text_impl::apply() and should be customized via ozo::get_query_text_impl specialization.
This is one of two points (see also ozo::get_query_params()) which should be used to support your own query type in the library. E.g.:
| query | — query object |
QueryText — query text with single SQL statement
|
constexpr |
Construct built-in Query implementation object.
Construct built-in Query implementation object from specified text and variadic parameters.
| text | — query text implementation with PostgreSQL native markup with variable place holder format is $n, there n - parameter position in the params begining from 1. |
| params | — query parameters |
Query object | binary_query ozo::to_binary_query | ( | const BinaryQueryConvertible & | query, |
| const OidMap & | oid_map, | ||
| const Allocator & | allocator = Allocator{} |
||
| ) |
Convert a query object to the binary representation.
This function provides an ability to convert a query object to the protocol compatible binary representation to send it to the PostgreSQL database. A user may call this function to reuse the binary_query and eliminate unnecessarily conversion of the query object to its binary representation each operation. E.g., this may be useful with the failover micro-framework.
| query | — a query object to convert to the binary representation. |
| oid_map | — OidMap to type OIDs for the binary representation. |
| allocator | — allocator to use for the data of ozo::binary_query. |
ozo::binary_query — the binary representation.
|
constexprnoexcept |
Convert QueryText to const char*.
Convert QueryText to const char* for futher transfer to a database. This function invokes ozo::to_const_char_impl::apply() and should be customized via ozo::to_const_char_impl specialization. Built-in support for types:
const char*,std::string,std::string_view,boost::hana::string.This point should be used to add support for your own query text type. E.g.:
ozo::to_const_char_impl::apply() should be noexcept.| text | — query text to transform to const char* |
const char*