|
libpqxx
The C++ client library for PostgreSQL
|
The home of all libpqxx classes, functions, templates, etc. More...
Namespaces | |
| internal | |
| Private namespace for libpqxx's internal use; do not access. | |
Classes | |
| class | array |
| An SQL array received from the database. More... | |
| struct | string_traits< array< ELEMENT, DIMENSIONS, array_separator< ELEMENT > > > |
| String traits for SQL arrays represented as pqxx::array. More... | |
| struct | nullness< array< ELEMENT, DIMENSIONS, array_separator< ELEMENT > > > |
| No-null trait for SQL arrays represented as pqxx::array. More... | |
| struct | nullness< CONT > |
| A container of nonbinary data. It has no inherent null value. More... | |
| struct | string_traits< CONT > |
| A container of nonbinary data can represent a 1-dimensional SQL array. More... | |
| class | array_parser |
| Low-level parser for C++ arrays. More... | |
| class | blob |
| struct | notification |
| An incoming notification. More... | |
| class | connection |
| Connection to a database. More... | |
| class | connecting |
| An ongoing, non-blocking stepping stone to a connection. More... | |
| class | cursor_base |
| Common definitions for cursor types. More... | |
| class | stateless_cursor |
| "Stateless cursor" class: easy API for retrieving parts of result sets More... | |
| class | icursorstream |
| Simple read-only cursor represented as a stream of results. More... | |
| class | icursor_iterator |
| Approximate istream_iterator for icursorstream. More... | |
| class | dbtransaction |
| Abstract transaction base class: bracket transactions on the database. More... | |
| class | errorhandler |
| class | quiet_errorhandler |
| struct | failure |
| Base class for all exceptions specific to libpqxx. More... | |
| struct | broken_connection |
| Exception class for lost or failed backend connection. More... | |
| struct | version_mismatch |
| Could not establish connection due to version mismatch. More... | |
| struct | variable_set_to_null |
| The caller attempted to set a variable to null, which is not allowed. More... | |
| struct | sql_error |
| Exception class for failed queries. More... | |
| struct | protocol_violation |
| Exception class for mis-communication with the server. More... | |
| struct | in_doubt_error |
| "Help, I don't know whether transaction was committed successfully!" More... | |
| struct | transaction_rollback |
| The backend saw itself forced to roll back the ongoing transaction. More... | |
| struct | serialization_failure |
| Transaction failed to serialize. Please retry the whole thing. More... | |
| struct | statement_completion_unknown |
| We can't tell whether our last statement succeeded. More... | |
| struct | deadlock_detected |
| The ongoing transaction has deadlocked. Retrying it may help. More... | |
| struct | internal_error |
| Internal error in libpqxx library. More... | |
| struct | usage_error |
| Error in usage of libpqxx library, similar to std::logic_error. More... | |
| struct | argument_error |
| Invalid argument passed to libpqxx, similar to std::invalid_argument. More... | |
| struct | conversion_error |
| Value conversion failed, e.g. when converting "Hello" to int. More... | |
| struct | unexpected_null |
| Could not convert null value: target type does not support null. More... | |
| struct | conversion_overrun |
| Could not convert value to string: not enough buffer space. More... | |
| struct | range_error |
| Something is out of range, similar to std::out_of_range. More... | |
| struct | unexpected_rows |
| Query returned an unexpected number of rows. More... | |
| struct | feature_not_supported |
| Database feature not supported in current setup. More... | |
| struct | data_exception |
| Error in data provided to SQL statement. More... | |
| struct | integrity_constraint_violation |
| struct | restrict_violation |
| struct | not_null_violation |
| struct | foreign_key_violation |
| struct | unique_violation |
| struct | check_violation |
| struct | invalid_cursor_state |
| struct | invalid_sql_statement_name |
| struct | invalid_cursor_name |
| struct | syntax_error |
| struct | undefined_column |
| struct | undefined_function |
| struct | undefined_table |
| struct | insufficient_privilege |
| struct | insufficient_resources |
| Resource shortage on the server. More... | |
| struct | disk_full |
| struct | server_out_of_memory |
| struct | too_many_connections |
| struct | plpgsql_error |
| PL/pgSQL error. More... | |
| struct | plpgsql_raise |
| Exception raised in PL/pgSQL procedure. More... | |
| struct | plpgsql_no_data_found |
| struct | plpgsql_too_many_rows |
| class | field_ref |
| Lightweight reference to a field in a result set. More... | |
| class | field |
| Reference to a field in a result set. More... | |
| class | field_streambuf |
| class | basic_fieldstream |
| Input stream that gets its data from a result field. More... | |
| struct | nullness< T > |
| The built-in arithmetic types do not have inherent null values. More... | |
| struct | string_traits< short > |
| struct | string_traits< unsigned short > |
| struct | string_traits< int > |
| struct | string_traits< unsigned > |
| struct | string_traits< long > |
| struct | string_traits< unsigned long > |
| struct | string_traits< long long > |
| struct | string_traits< unsigned long long > |
| struct | string_traits< float > |
| struct | string_traits< double > |
| struct | string_traits< long double > |
| struct | string_traits< bool > |
| struct | nullness< std::optional< T > > |
| struct | string_traits< std::optional< T > > |
| struct | nullness< std::variant< T... > > |
| struct | string_traits< std::variant< T... > > |
| struct | string_traits< std::nullptr_t > |
| struct | string_traits< std::nullopt_t > |
| struct | string_traits< std::monostate > |
| struct | nullness< char const * > |
| struct | string_traits< char const * > |
| String traits for C-style string ("pointer to char const"). More... | |
| struct | nullness< char * > |
| struct | string_traits< char * > |
| String traits for non-const C-style string ("pointer to char"). More... | |
| struct | nullness< char[N]> |
| struct | string_traits< char[N]> |
| String traits for C-style string constant ("pointer to array of char"). More... | |
| struct | nullness< std::string > |
| struct | string_traits< std::string > |
| struct | nullness< std::string_view > |
There's no real null value for std::string_view. More... | |
| struct | string_traits< std::string_view > |
String traits for string_view. More... | |
| struct | nullness< zview > |
| struct | string_traits< zview > |
String traits for zview. More... | |
| struct | nullness< std::stringstream > |
| struct | string_traits< std::stringstream > |
| struct | nullness< std::nullptr_t > |
| struct | nullness< std::nullopt_t > |
| struct | nullness< std::monostate > |
| struct | nullness< std::unique_ptr< T > > |
| struct | string_traits< std::unique_ptr< T, Args... > > |
| struct | nullness< std::shared_ptr< T > > |
| struct | string_traits< std::shared_ptr< T > > |
| struct | nullness< DATA > |
| struct | string_traits< DATA > |
| struct | string_traits< T > |
| String traits for SQL arrays. More... | |
| struct | string_traits< encoding_group > |
| class | const_result_iterator |
| Iterator for rows in a result. Use as result::const_iterator. More... | |
| class | const_reverse_result_iterator |
| Reverse iterator for result. Use as result::const_reverse_iterator. More... | |
| class | stream_query |
| class | largeobject |
| Identity of a large object. More... | |
| class | largeobjectaccess |
| Accessor for large object's contents. More... | |
| class | largeobject_streambuf |
| Streambuf to use large objects in standard I/O streams. More... | |
| class | basic_ilostream |
| Input stream that gets its data from a large object. More... | |
| class | basic_olostream |
| Output stream that writes data back to a large object. More... | |
| class | basic_lostream |
| Stream that reads and writes a large object. More... | |
| class | nontransaction |
| Simple "transaction" class offering no transactional integrity. More... | |
| class | notification_receiver |
| class | params |
| Build a parameter list for a parameterised or prepared statement. More... | |
| class | placeholders |
| Generate parameter placeholders for use in an SQL statement. More... | |
| class | pipeline |
| Processes several queries in FIFO manner, optimized for high throughput. More... | |
| class | prepped |
| A string that is the name of a prepared statement. More... | |
| struct | no_bound |
| An unlimited boundary value to a pqxx::range. More... | |
| class | inclusive_bound |
| An inclusive boundary value to a pqxx::range. More... | |
| class | exclusive_bound |
| An exclusive boundary value to a pqxx::range. More... | |
| class | range_bound |
| A range boundary value. More... | |
| class | range |
| A C++ equivalent to PostgreSQL's range types. More... | |
| struct | string_traits< range< TYPE > > |
| String conversions for a range type. More... | |
| struct | nullness< range< TYPE > > |
| A range type does not have an innate null value. More... | |
| class | result |
| Result set containing data returned by a query or command. More... | |
| class | robusttransaction |
| Slightly slower, better-fortified version of transaction. More... | |
| class | row_ref |
| Lightweight reference to one row in a result. More... | |
| class | row |
| Reference to one row in a result. More... | |
| class | const_row_iterator |
| Iterator for fields in a row. Use as row::const_iterator. More... | |
| class | const_reverse_row_iterator |
| Reverse iterator for a row. Use as row::const_reverse_iterator. More... | |
| struct | nullness |
| Traits describing a type's "null value," if any. More... | |
| struct | no_null |
| Nullness traits describing a type which does not have a null value. More... | |
| struct | all_null |
| Nullness traits describing a type whose values are always null. More... | |
| struct | conversion_context |
| Contextual parameters for string conversions implementations. More... | |
| struct | string_traits |
| Traits class for use in string conversions. More... | |
| struct | forbidden_conversion |
| String traits for a forbidden type conversion. More... | |
| struct | string_traits< char > |
You cannot convert a char to/from SQL. More... | |
| struct | string_traits< unsigned char > |
You cannot convert an unsigned char to/from SQL. More... | |
| struct | string_traits< signed char > |
You cannot convert a signed char to/from SQL. More... | |
| struct | string_traits< std::byte > |
You cannot convert a std::byte to/from SQL. More... | |
| struct | nullness< ENUM > |
| Nullness: Enums do not have an inherent null value. More... | |
| class | stream_from |
| Stream data from the database. More... | |
| class | stream_to |
| Efficiently write data directly to a database table. More... | |
| class | subtransaction |
| "Transaction" nested within another transaction More... | |
| class | transaction |
| transaction Standard back-end transaction, templatised on isolation level. More... | |
| class | transaction_base |
| Interface definition (and common code) for "transaction" classes. More... | |
| class | transaction_focus |
| Base class for things that monopolise a transaction's attention. More... | |
| struct | stacktrace_placeholder |
There is no std::stacktrace on this system. Use a placeholder. More... | |
| struct | from_table_t |
| Marker for stream_from constructors: "stream from table.". More... | |
| struct | from_query_t |
| Marker for stream_from constructors: "stream from query.". More... | |
| struct | thread_safety_model |
| Descriptor of library's thread-safety model. More... | |
| struct | byte_char_traits |
Custom std::char_trast if the compiler does not provide one. More... | |
| class | zview |
Marker-type wrapper: zero-terminated std::string_view. More... | |
Typedefs | |
| using | table_path = std::initializer_list< std::string_view > |
| Representation of a PostgreSQL table path. More... | |
| using | fieldstream = basic_fieldstream< char > |
| using | ilostream = basic_ilostream< char > |
| using | olostream = basic_olostream< char > |
| using | lostream = basic_lostream< char > |
| using | ctx = conversion_context const & |
Convenience alias: const reference to a pqxx::conversion_context. More... | |
| using | work = transaction< isolation_level::read_committed, write_policy::read_write > |
| The default transaction type. More... | |
| using | read_transaction = transaction< isolation_level::read_committed, write_policy::read_only > |
| Read-only transaction. More... | |
| using | sl = std::source_location |
Convenience alias for std::source_location. It's just too long. More... | |
| using | st = stacktrace_placeholder |
Placeholder for future std::stacktrace. More... | |
| using | oid = unsigned int |
| PostgreSQL database row identifier. More... | |
| using | result_size_type = int |
| Number of rows in a result set. More... | |
| using | result_difference_type = int |
| Difference between result sizes. More... | |
| using | row_size_type = int |
| Number of fields in a row of database data. More... | |
| using | row_difference_type = int |
| Difference between row sizes. More... | |
| using | field_size_type = std::size_t |
| Number of bytes in a field of database data. More... | |
| using | large_object_size_type = int64_t |
| Number of bytes in a large object. More... | |
| template<typename TYPE > | |
| using | strip_t = std::remove_cvref_t< TYPE > |
| Remove any constness, volatile, and reference-ness from a type. More... | |
| template<std::ranges::range CONTAINER> | |
| using | value_type = std::remove_cvref_t< std::ranges::range_value_t< CONTAINER > > |
| The type of a container's elements. More... | |
| using | bytes_view = std::span< std::byte const > |
| Type alias for a view of bytes. More... | |
| using | writable_bytes_view = std::span< std::byte > |
| Type alias for a view of writable bytes. More... | |
| using | bytes = std::vector< std::byte > |
| Type alias for a container containing bytes. More... | |
Enumerations | |
| enum | skip_init : int { nothing , openssl , crypto } |
| Flags for skipping initialisation of SSL-related libraries. More... | |
| enum class | error_verbosity : int { terse = 0 , normal = 1 , verbose = 2 } |
| Error verbosity levels. More... | |
| enum class | encoding_group { unknown , ascii_safe , two_tier , gb18030 , sjis } |
| enum class | write_policy { read_only , read_write } |
| Should a transaction be read-only, or read-write? More... | |
| enum | isolation_level { read_committed , repeatable_read , serializable } |
| Transaction isolation levels. More... | |
| enum class | format : int { text = 0 , binary = 1 } |
| Format code: is data text or binary? More... | |
Functions | |
| template<> | |
| constexpr std::string_view | name_type< ExecStatusType > () noexcept |
| ::PGresult * | real_res (pqxx::internal::pq::PGresult *ptr) noexcept |
| Cast a pqxx::internal::pq::PGresult pointer back to its real type. More... | |
| ::PGresult const * | real_res (pqxx::internal::pq::PGresult const *ptr) noexcept |
| Cast a pqxx::internal::pq::PGresult pointer back to its real type. More... | |
| int | pq_n_tuples (pqxx::internal::pq::PGresult const *ptr) noexcept |
Wrapper for PQntuples() that deals in our placeholder types. More... | |
| template<typename... T> | |
| void | parse_composite (ctx c, std::string_view text, T &...fields) |
| Parse a string representation of a value of a composite type. More... | |
| template<typename... T> | |
| std::size_t | composite_size_buffer (T const &...fields) noexcept |
| Estimate the buffer size needed to represent a value of a composite type. More... | |
| template<typename... T> | |
| zview | composite_into_buf (ctx c, std::span< char > buf, T const &...fields) |
| Render a series of values as a single composite SQL value. More... | |
| template<typename... T> | |
| char * | composite_into_buf (char *begin, char *end, T const &...fields) |
| Render a series of values as a single composite SQL value. More... | |
| template<skip_init... SKIP> | |
| void | skip_init_ssl () noexcept |
| Control initialisation of OpenSSL and libcrypto libraries. More... | |
| template<typename CHAR > | |
| std::basic_ostream< CHAR > & | operator<< (std::basic_ostream< CHAR > &s, field const &value) |
| Write a result field to any type of stream. More... | |
| template<typename T > | |
| T | from_string (field const &value, ctx c={}) |
Convert a field's value to type T. More... | |
| template<typename T > | |
| T | from_string (field_ref const &value, ctx c={}) |
Convert a field's value to type T. More... | |
| template<> | |
| std::nullptr_t | from_string< std::nullptr_t > (field const &value, ctx c) |
Convert a field's value to nullptr_t. More... | |
| template<> | |
| PQXX_LIBEXPORT std::string | to_string (field_ref const &value, ctx) |
| Convert a field_ref to a string. More... | |
| template<> | |
| PQXX_LIBEXPORT std::string | to_string (field const &value, ctx) |
| Convert a field to a string. More... | |
| template<typename T > | |
| constexpr format | param_format (std::optional< T > const &value) |
| template<typename... Args> | |
| constexpr format | param_format (std::variant< Args... > const &value) |
| template<typename T > | |
| T | from_string (std::stringstream const &text, ctx c={}) |
| template<typename T , typename... Args> | |
| format | param_format (std::unique_ptr< T, Args... > const &value) |
| template<typename T > | |
| format | param_format (std::shared_ptr< T > const &value) |
| template<nonbinary_range T> | |
| constexpr format | param_format (T const &) |
| We don't know how to pass array params in binary format, so pass as text. More... | |
| template<typename TYPE > | |
| PQXX_INLINE_COV std::string | to_string (TYPE const &value, ctx c) |
| Convert a value to a readable string that PostgreSQL will understand. More... | |
| template<> | |
| std::string | to_string (float const &value, ctx c) |
| template<> | |
| std::string | to_string (double const &value, ctx c) |
| template<> | |
| std::string | to_string (long double const &value, ctx c) |
| template<> | |
| std::string | to_string (std::stringstream const &value, ctx) |
| template<typename T > | |
| void | into_string (T const &value, std::string &out, ctx c={}) |
| template<> | |
| constexpr std::string_view | name_type< encoding_group > () noexcept |
| const_result_iterator | operator+ (result::difference_type o, const_result_iterator const &i) |
| const_reverse_result_iterator | operator+ (result::difference_type n, const_reverse_result_iterator const &i) |
| const_row_iterator | operator+ (const_row_iterator::difference_type o, const_row_iterator const &i) noexcept |
| template<std::forward_iterator ITER, typename ACCESS > | |
| std::string | separated_list (std::string_view sep, ITER begin, ITER end, ACCESS access, ctx c={}) |
| Represent sequence of values as a string, joined by a given separator. More... | |
| template<std::forward_iterator ITER> | |
| std::string | separated_list (std::string_view sep, ITER begin, ITER end, ctx c={}) |
| Render sequence as a string, using given separator between items. More... | |
| template<std::ranges::range CONTAINER> | |
| std::string | separated_list (std::string_view sep, CONTAINER &&con, ctx c={}) |
| Render items in a container as a string, using given separator. More... | |
| template<typename TUPLE , std::size_t INDEX = 0, typename ACCESS > | |
| std::string | separated_list (std::string_view sep, TUPLE const &t, ACCESS const &access, ctx c={}) |
| Render items in a tuple as a string, using given separator. More... | |
| template<typename TUPLE , std::size_t INDEX = 0> | |
| std::string | separated_list (std::string_view sep, TUPLE const &t, ctx c={}) |
| template<typename... TYPE> | |
| constexpr std::size_t | size_buffer (TYPE const &...value) noexcept |
| Estimate how much buffer space is needed to represent values as a string. More... | |
| template<typename TYPE > | |
| requires (pqxx::internal::to_buf_7< TYPE > or pqxx::internal::to_buf_8< TYPE >) const eval bool supports_to_buf_8() | |
Is the libpqxx 8 version of to_buf() supported for TYPE? More... | |
| template<typename TYPE > | |
| std::string_view | to_buf (std::span< char > buf, TYPE const &value, ctx c={}) |
Represent value as SQL text, optionally using buf as storage. More... | |
| template<typename TYPE > | |
| std::size_t | into_buf (std::span< char > buf, TYPE const &value, ctx c={}) |
Write an SQL representation of value into buf. More... | |
| template<typename TYPE > | |
| requires (pqxx::internal::from_string_7< TYPE > or pqxx::internal::from_string_8< TYPE >) const eval bool supports_from_string_8() | |
Is the libpqxx 8 version of from_string() supported for TYPE? More... | |
| template<typename TYPE > | |
| TYPE | from_string (std::string_view text, ctx c={}) |
| Parse a value in postgres' text format as a TYPE. More... | |
| template<> | |
| std::string_view | from_string (std::string_view text, ctx) |
| "Convert" a std::string_view to a std::string_view. More... | |
| template<typename T > | |
| void | from_string (std::string_view text, T &value, ctx c={}) |
| Attempt to convert postgres-generated string to given built-in object. More... | |
| template<typename TYPE > | |
| std::string | to_string (TYPE const &value, ctx c={}) |
| Convert a value to a readable string that PostgreSQL will understand. More... | |
| template<typename... TYPE> | |
| std::vector< std::string_view > | to_buf (char *begin, char const *end, TYPE... value) |
| Convert multiple values to strings inside a single buffer. More... | |
| template<typename... TYPE> | |
| std::vector< std::string_view > | to_buf_multi (ctx c, std::span< char > buf, TYPE... value) |
| Convert multiple values to strings inside a single buffer. More... | |
| template<typename... TYPE> | |
| std::vector< std::string_view > | to_buf_multi (std::span< char > buf, TYPE... value) |
| Convert multiple values to strings inside a single buffer. More... | |
| template<typename TYPE > | |
| void | into_string (TYPE const &value, std::string &out) |
| Convert a value to a readable string that PostgreSQL will understand. More... | |
| template<typename TYPE > | |
| constexpr bool | has_null () noexcept |
Does TYPE have one or more inherent null values? More... | |
| template<typename TYPE > | |
| constexpr bool | always_null () noexcept |
Is a value of TYPE always null? More... | |
| template<typename TYPE > | |
| constexpr bool | is_null (TYPE const &value) noexcept |
Is value a null? More... | |
| template<typename TYPE > | |
| constexpr TYPE | make_null () requires(pqxx |
Return a null value of TYPE. More... | |
| template<typename TYPE > | |
| constexpr format | param_format (TYPE const &) |
| What's the preferred format for passing non-null parameters of this type? More... | |
| template<typename TRANSACTION_CALLBACK > | |
| std::invoke_result_t< TRANSACTION_CALLBACK > | perform (TRANSACTION_CALLBACK &&callback, int attempts, sl loc=sl::current()) |
| Simple way to execute a transaction with automatic retry. More... | |
| template<typename TRANSACTION_CALLBACK > | |
| std::invoke_result_t< TRANSACTION_CALLBACK > | perform (TRANSACTION_CALLBACK &&callback, sl loc=sl::current()) |
| Simple way to execute a transaction with automatic retry. More... | |
| template<typename TYPE > | |
| constexpr std::string_view | name_type () noexcept |
Return human-readable name for TYPE. More... | |
| template<> | |
| constexpr PQXX_PURE std::string_view | name_type< std::string > () noexcept |
| Specialisation to save on startup work & produce friendlier output. More... | |
| template<> | |
| constexpr PQXX_PURE std::string_view | name_type< std::string_view > () noexcept |
| Specialisation to save on startup work & produce friendlier output. More... | |
| template<> | |
| constexpr PQXX_PURE std::string_view | name_type< char const * > () noexcept |
| template<> | |
| constexpr PQXX_PURE std::string_view | name_type< bool > () noexcept |
| Specialisation to save on startup work. More... | |
| template<> | |
| constexpr PQXX_PURE std::string_view | name_type< short > () noexcept |
| Specialisation to save on startup work. More... | |
| template<> | |
| constexpr PQXX_PURE std::string_view | name_type< int > () noexcept |
| Specialisation to save on startup work. More... | |
| template<> | |
| constexpr PQXX_PURE std::string_view | name_type< long > () noexcept |
| Specialisation to save on startup work. More... | |
| template<> | |
| constexpr PQXX_PURE std::string_view | name_type< long long > () noexcept |
| Specialisation to save on startup work. More... | |
| template<> | |
| constexpr PQXX_PURE std::string_view | name_type< unsigned short > () noexcept |
| Specialisation to save on startup work. More... | |
| template<> | |
| constexpr PQXX_PURE std::string_view | name_type< unsigned > () noexcept |
| Specialisation to save on startup work. More... | |
| template<> | |
| constexpr PQXX_PURE std::string_view | name_type< unsigned long > () noexcept |
| Specialisation to save on startup work. More... | |
| template<> | |
| constexpr PQXX_PURE std::string_view | name_type< unsigned long long > () noexcept |
| Specialisation to save on startup work. More... | |
| template<> | |
| constexpr PQXX_PURE std::string_view | name_type< float > () noexcept |
| Specialisation to save on startup work. More... | |
| template<> | |
| constexpr PQXX_PURE std::string_view | name_type< double > () noexcept |
| Specialisation to save on startup work. More... | |
| template<> | |
| constexpr PQXX_PURE std::string_view | name_type< long double > () noexcept |
| Specialisation to save on startup work. More... | |
| template<> | |
| constexpr PQXX_PURE std::string_view | name_type< std::nullptr_t > () noexcept |
| Specialisation to save on startup work. More... | |
| template<typename TO , typename FROM > | |
| TO | check_cast (FROM value, std::string_view description, sl loc=sl::current()) requires(std |
| Cast a numeric value to another type, or throw if it underflows/overflows. More... | |
| PQXX_LIBEXPORT thread_safety_model | describe_thread_safety () |
| Describe thread safety available in this build. More... | |
| template<potential_binary TYPE> | |
| bytes_view | binary_cast (TYPE const &data) |
| Cast binary data to a type that libpqxx will recognise as binary. More... | |
| template<char_sized CHAR, typename SIZE > | |
| bytes_view | binary_cast (CHAR const *data, SIZE size) |
| Construct a type that libpqxx will recognise as binary. More... | |
| template<> | |
| constexpr std::string_view | name_type< zview > () noexcept |
| constexpr PQXX_ZARGS zview | operator""_zv (char const str[], std::size_t len) noexcept |
| Support zview literals. More... | |
| constexpr bool | operator== (char const lhs[], pqxx::zview rhs) noexcept |
Disambiguating comparison operator: leave it to std::string_view. More... | |
| constexpr bool | operator!= (char const lhs[], pqxx::zview rhs) noexcept |
Disambiguating comparison operator: leave it to std::string_view. More... | |
Variables | |
| template<> | |
| constexpr std::string_view | type_name< ExecStatusType > {"ExecStatusType"} |
| template<typename T > | |
| concept | ZKey_ZValues |
| Concept: T is a range of pairs of zero-terminated strings. More... | |
| template<pqxx::internal::integer T> | |
| constexpr bool | is_unquoted_safe< T > {true} |
| template<> | |
| constexpr bool | is_unquoted_safe< bool > {true} |
| template<nonbinary_range T> | |
| constexpr bool | is_sql_array< T > {true} |
| template<> | |
| constexpr std::string_view | type_name< encoding_group > {"encoding_group"} |
| template<typename T > | |
| concept | has_less = std::copy_constructible<T> and requires(T n) { n < n; } |
Concept: T supports copying, and less-than operator. More... | |
| template<typename T > | |
| concept | has_equal = requires(T n) { n == n; } |
Concept: T supports equality comparison. More... | |
| template<typename TYPE > | |
| constexpr bool | is_sql_array {false} |
| Does this type translate to an SQL array? More... | |
| template<typename TYPE > | |
| constexpr bool | is_unquoted_safe {false} |
| Can we use this type in arrays and composite types without quoting them? More... | |
| template<typename T > | |
| constexpr char | array_separator {','} |
| Element separator between SQL array elements of this type. More... | |
| constexpr from_table_t | from_table |
Pass this to a stream_from constructor to stream table contents. More... | |
| constexpr from_query_t | from_query |
Pass this to a stream_from constructor to stream query results. More... | |
| template<typename CHAR > | |
| concept | char_sized = (sizeof(CHAR) == 1) |
| A type one byte in size. More... | |
| template<typename STRING > | |
| concept | char_string |
Concept: Any type that we can read as a string of char. More... | |
| template<typename RANGE > | |
| concept | char_strings |
| Concept: Anything we can iterate to get things we can read as strings. More... | |
| template<typename DATA > | |
| concept | potential_binary |
| Concept: Anything we might want to treat as binary data. More... | |
| template<typename T > | |
| concept | binary |
Concept: Binary string, akin to std::string for binary data. More... | |
| template<typename T > | |
| concept | nonbinary_range |
| A series of something that's not bytes. More... | |
| template<typename T > | |
| concept | not_borrowed |
| Concept: A value that's not just a reference to values elsewhere. More... | |
| template<typename E > | |
| concept | enum_type = std::is_enum_v<E> |
Concept: A C++ enum type. More... | |
| template<typename TYPE > | |
| std::string const | type_name |
| A human-readable name for a type, used in error messages and such. More... | |
| constexpr oid | oid_none {0} |
| The "null" oid. More... | |
| constexpr std::string_view const | version {"8.0.1"} |
| Full libpqxx version string. More... | |
| constexpr std::string_view const | abi_version {"8.0"} |
| Libpqxx ABI version string: major and minor version, but no patch. More... | |
| constexpr int const | version_major {8} |
| Major libpqxx version number. (E.g. for libpqxx 9.3.1, this will be 9.) More... | |
| constexpr int const | version_minor {0} |
| Minor libpqxx version number. (E.g. for libpqxx 9.3.1, this will be 3.) More... | |
| constexpr int const | version_patch {1} |
| Libpqxx patch version number. (E.g. for libpqxx 9.3.1, this will be 1.) More... | |
| template<typename T > | |
| concept | ZString |
| Concept: T is a known zero-terminated string type. More... | |
The home of all libpqxx classes, functions, templates, etc.
Handling of SQL arrays.
Copyright (c) 2000-2026, Jeroen T. Vermeulen.
See COPYING for copyright license. If you did not receive a file called COPYING with this source code, please notify the distributor of this mistake, or contact the author.
Implementation of libpqxx exception classes.
Copyright (c) 2000-2026, Jeroen T. Vermeulen.
See COPYING for copyright license. If you did not receive a file called COPYING with this source code, please notify the distributor of this mistake, or contact the author.
Implementation of the pqxx::result class and support classes.
pqxx::result represents the set of result rows from a database query
Copyright (c) 2000-2026, Jeroen T. Vermeulen.
See COPYING for copyright license. If you did not receive a file called COPYING with this source code, please notify the distributor of this mistake, or contact the author.
Enum type for supporting encodings in libpqxx
Copyright (c) 2000-2026, Jeroen T. Vermeulen.
See COPYING for copyright license. If you did not receive a file called COPYING with this source code, please notify the distributor of this mistake, or contact the author.
Internal string encodings support for libpqxx
Copyright (c) 2000-2026, Jeroen T. Vermeulen.
See COPYING for copyright license. If you did not receive a file called COPYING with this source code, please notify the distributor of this mistake, or contact the author.
Result loops.
Copyright (c) 2000-2026, Jeroen T. Vermeulen.
See COPYING for copyright license. If you did not receive a file called COPYING with this source code, please notify the distributor of this mistake, or contact the author.
Stream iterators.
Copyright (c) 2000-2026, Jeroen T. Vermeulen.
See COPYING for copyright license. If you did not receive a file called COPYING with this source code, please notify the distributor of this mistake, or contact the author.
Transaction focus: types which monopolise a transaction's attention.
Copyright (c) 2000-2026, Jeroen T. Vermeulen.
See COPYING for copyright license. If you did not receive a file called COPYING with this source code, please notify the distributor of this mistake, or contact the author.
| struct pqxx::notification |
An incoming notification.
PostgreSQL extends SQL with a "message bus" using the LISTEN and NOTIFY commands. In libpqxx you use connection::listen() and (optionally) transaction_base::notify().
When you receive a notification for which you have been listening, your handler receives it in the form of a notification object.
Collaboration diagram for pqxx::notification:| Class Members | ||
|---|---|---|
| int | backend_pid |
Process ID of the backend that sent the notification. This can be useful in situations where a multiple clients are listening on the same channel, and also send notifications on it. In those situations, it often makes sense for a client to ignore its own incoming notifications, but handle all others on the same channel in some way. To check for that, compare this process ID to the return value of the connection's |
| zview | channel |
Channel name. The notification logic will only pass the notification to a handler which was registered to listen on this exact name. |
| connection & | conn |
The connection which received the notification. There will be no backend transaction active on the connection when your handler gets called, but there may be a nontransaction. (This is a special transaction type in libpqxx which does not start a transaction on the backend.) |
| zview | payload |
Optional payload text. If the notification did not carry a payload, the string will be empty. |
| class pqxx::stream_query |
| struct pqxx::from_table_t |
Marker for stream_from constructors: "stream from table.".
| struct pqxx::from_query_t |
Marker for stream_from constructors: "stream from query.".
| struct pqxx::thread_safety_model |
Descriptor of library's thread-safety model.
This describes what the library knows about various risks to thread-safety.
| using pqxx::bytes = typedef std::vector<std::byte> |
Type alias for a container containing bytes.
| using pqxx::bytes_view = typedef std::span<std::byte const> |
Type alias for a view of bytes.
| using pqxx::ctx = typedef conversion_context const & |
Convenience alias: const reference to a pqxx::conversion_context.
Because we need to squeeze this type into lots of function signatures, it helps to have a very terse name for it.
| using pqxx::field_size_type = typedef std::size_t |
Number of bytes in a field of database data.
| using pqxx::fieldstream = typedef basic_fieldstream<char> |
field::as<...>() or field::c_str(). | using pqxx::ilostream = typedef basic_ilostream<char> |
| using pqxx::large_object_size_type = typedef int64_t |
Number of bytes in a large object.
| using pqxx::lostream = typedef basic_lostream<char> |
| using pqxx::oid = typedef unsigned int |
PostgreSQL database row identifier.
| using pqxx::olostream = typedef basic_olostream<char> |
| using pqxx::result_difference_type = typedef int |
Difference between result sizes.
| using pqxx::result_size_type = typedef int |
Number of rows in a result set.
| using pqxx::row_difference_type = typedef int |
Difference between row sizes.
| using pqxx::row_size_type = typedef int |
Number of fields in a row of database data.
| using pqxx::sl = typedef std::source_location |
Convenience alias for std::source_location. It's just too long.
| using pqxx::st = typedef stacktrace_placeholder |
Placeholder for future std::stacktrace.
| using pqxx::strip_t = typedef std::remove_cvref_t<TYPE> |
Remove any constness, volatile, and reference-ness from a type.
std::remove_cvref instead. | using pqxx::table_path = typedef std::initializer_list<std::string_view> |
Representation of a PostgreSQL table path.
A "table path" consists of a table name, optionally prefixed by a schema name, which in turn is optionally prefixed by a database name.
A minimal example of a table path would be {mytable}. But a table path may also take the forms {myschema,mytable} or {mydb,myschema,mytable}.
| using pqxx::value_type = typedef std::remove_cvref_t<std::ranges::range_value_t<CONTAINER> > |
The type of a container's elements.
At the time of writing there's a similar thing in std::experimental, which we may or may not end up using for this.
| using pqxx::writable_bytes_view = typedef std::span<std::byte> |
Type alias for a view of writable bytes.
|
strong |
The supported types of text encoding supported.
See: https://www.postgresql.org/docs/current/static/multibyte.html#CHARSET-TABLE
This enum does not name the individual supported encodings, only the various schemes for determining where in memory a character ends and a potential new one may begin. This is crucial for determining such things as where a string ends: a byte in the text may look like an ASCII quote character, but is it really the closing quote, or is it merely a byte inside a multibyte character which just happens to have the same value as the ASCII value for a quote? This is not an issue in most encodings, but it can happen in others, and can pose a real security risk.
Some functions in libpqxx need to know the type of encoding used in a given text in order to find closing quotes or field boundaries.
All supported encodings are supersets of ASCII: any byte with a value between 0 and 127 inclusive at the beginning of a character is always a simple, single-byte ASCII character.
|
strong |
|
strong |
Transaction isolation levels.
These are as defined in the SQL standard. But there are a few notes specific to PostgreSQL.
First, postgres does not support "read uncommitted." The lowest level you can get is "read committed," which is better. PostgreSQL is built on the MVCC paradigm, which guarantees "read committed" isolation without any additional performance overhead, so there was no point in providing the lower level.
Second, "repeatable read" also makes more isolation guarantees than the standard requires. According to the standard, this level prevents "dirty reads" and "nonrepeatable reads," but not "phantom reads." In postgres, it actually prevents all three.
Third, "serializable" is only properly supported starting at postgres 9.1. If you request "serializable" isolation on an older backend, you will get the same isolation as in "repeatable read." It's better than the "repeatable read" defined in the SQL standard, but not a complete implementation of the standard's "serializable" isolation level.
In general, a lower isolation level will allow more surprising interactions between ongoing transactions, but improve performance. A higher level gives you more protection from subtle concurrency bugs, but sometimes it may not be possible to complete your transaction without avoiding paradoxes in the data. In that case a transaction may fail, and the application will have to re-do the whole thing based on the latest state of the database. (If you want to retry your code in that situation, have a look at the transactor framework.)
Study the levels and design your application with the right level in mind.
| Enumerator | |
|---|---|
| read_committed | |
| repeatable_read | |
| serializable | |
| enum pqxx::skip_init : int |
Flags for skipping initialisation of SSL-related libraries.
When a running process makes its first SSL connection to a database through libpqxx, libpq automatically initialises the OpenSSL and libcrypto libraries. But there are scenarios in which you may want to suppress that.
This enum is a way to express this. Pass values of this enum to pqxx::skip_init_ssl as template arguments.
| Enumerator | |
|---|---|
| nothing | A do-nothing flag that does not affect anything. |
| openssl | Skip initialisation of OpenSSL library. |
| crypto | Skip initialisation of libcrypto. |
|
strong |
|
inlineconstexprnoexcept |
Is a value of TYPE always null?
This is the case for some special types, such as std::nullopt_t.
| bytes_view pqxx::binary_cast | ( | CHAR const * | data, |
| SIZE | size | ||
| ) |
Construct a type that libpqxx will recognise as binary.
Takes a data pointer and a size, without being too strict about their types, and constructs a pqxx::bytes_view pointing to the same data.
This makes it a little easier to turn binary data, in whatever form you happen to have it, into binary data as libpqxx understands it.
|
inline |
Cast binary data to a type that libpqxx will recognise as binary.
There are many different formats for storing binary data in memory. You may have yours as a std::string, or a std::vector<uchar_t>, or one of many other types. In libpqxx we commend a container of std::byte.
For libpqxx to recognise your data as binary, we recommend using a pqxx::bytes, or a pqxx::bytes_view; but any contiguous block of std::byte should do.
Use binary_cast as a convenience helper to cast your data as a pqxx::bytes_view.
|
inline |
Cast a numeric value to another type, or throw if it underflows/overflows.
Both types must be arithmetic types, and they must either be both integral or both floating-point types.
|
inline |
Render a series of values as a single composite SQL value.
|
inline |
Render a series of values as a single composite SQL value.
You may use this as a helper while implementing your own string_traits for a composite type.
| loc | An std::source_location, so that any error messages can report this as the place where the error occurred. This is probably more useful to you than a location inside this function itself. |
After writing the composite's text representation to buf, this will append a terminating zero. This facilitates usage where the resulting SQL string gets passed in as a query parameter.
|
inlinenoexcept |
Estimate the buffer size needed to represent a value of a composite type.
Returns a conservative estimate.
| pqxx::thread_safety_model pqxx::describe_thread_safety | ( | ) |
Describe thread safety available in this build.
Convert a field's value to type T.
Unlike the "regular" from_string, this knows how to deal with null values.
Convert a field's value to type T.
Unlike the "regular" from_string, this knows how to deal with null values.
|
inline |
Parse a value in postgres' text format as a TYPE.
If the form of the value found in the string does not match the expected type, e.g. if a decimal point is found when converting to an integer type, the conversion fails. Overflows (e.g. converting "9999999999" to a 16-bit C++ type) are also treated as errors. If in some cases this behaviour should be inappropriate, convert to something bigger such as long int first and then truncate the resulting value.
Only the simplest possible conversions are supported. Fancy features like hexadecimal or octal, spurious signs, or exponent notation won't work. Whitespace is not stripped away. Only the kinds of strings that come out of PostgreSQL and out of to_string() can be converted.
|
inline |
"Convert" a std::string_view to a std::string_view.
Just returns its input.
|
inline |
Attempt to convert postgres-generated string to given built-in object.
This is like the single-argument form of the function, except instead of returning the value, it sets value.
You may find this more convenient in that it infers the type you want from the argument you pass. But there are disadvantages: it requires an assignment operator, and it may be less efficient.
|
inline |
|
inline |
Convert a field's value to nullptr_t.
Yes, you read that right. This conversion does nothing useful. It always returns nullptr.
Except... what if the field is not null? In that case, this throws conversion_error.
|
inlineconstexprnoexcept |
Does TYPE have one or more inherent null values?
Some types, such as pointers, have natural null values built in. Most types do not: an integer is never null (even if it may be zero), a C++ string is never null (even if it may be empty), and so on.
This is different from an SQL field containing a null value, but in libpqxx you can treat them pretty much the same.
|
inline |
Write an SQL representation of value into buf.
This calls string_traits<TYPE>::to_buf(), but bridges some API version differences.
buf. There is no terminating zero.
|
inline |
|
inline |
Convert a value to a readable string that PostgreSQL will understand.
This variant of to_string can sometimes save a bit of time in loops, by re-using a std::string for multiple conversions.
|
inlineconstexprnoexcept |
Is value a null?
|
inlineconstexpr |
Return a null value of TYPE.
Only available for types that have a null value.
There may be multiple null values, or even ones that look the same but which don't compare as equal, as is the case in SQL.
|
inlineconstexprnoexcept |
Return human-readable name for TYPE.
|
inlineconstexprnoexcept |
Specialisation to save on startup work.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Specialisation to save on startup work.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Specialisation to save on startup work.
|
inlineconstexprnoexcept |
Specialisation to save on startup work.
|
inlineconstexprnoexcept |
Specialisation to save on startup work.
|
inlineconstexprnoexcept |
Specialisation to save on startup work.
|
inlineconstexprnoexcept |
Specialisation to save on startup work.
|
inlineconstexprnoexcept |
Specialisation to save on startup work.
|
inlineconstexprnoexcept |
Specialisation to save on startup work.
|
inlineconstexprnoexcept |
Specialisation to save on startup work & produce friendlier output.
|
inlineconstexprnoexcept |
Specialisation to save on startup work & produce friendlier output.
|
inlineconstexprnoexcept |
Specialisation to save on startup work.
|
inlineconstexprnoexcept |
Specialisation to save on startup work.
|
inlineconstexprnoexcept |
Specialisation to save on startup work.
|
inlineconstexprnoexcept |
Specialisation to save on startup work.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Disambiguating comparison operator: leave it to std::string_view.
|
constexprnoexcept |
|
inlinenoexcept |
|
inline |
|
inline |
|
inline |
Write a result field to any type of stream.
This can be convenient when writing a field to an output stream. More importantly, it lets you write a field to e.g. a stringstream which you can then use to read, format and convert the field in ways that to() does not support.
Example: parse a field into a variable of the nonstandard long long type.
|
inlineconstexprnoexcept |
Disambiguating comparison operator: leave it to std::string_view.
|
inlineconstexpr |
| format pqxx::param_format | ( | std::shared_ptr< T > const & | value | ) |
|
inline |
|
inlineconstexpr |
|
inlineconstexpr |
We don't know how to pass array params in binary format, so pass as text.
A contiguous range of std::byte is a binary string; other ranges are not.
|
inlineconstexpr |
What's the preferred format for passing non-null parameters of this type?
This affects how we pass parameters of TYPE when calling parameterised statements or prepared statements.
Generally we pass parameters in text format, but binary strings are the exception. We also pass nulls in binary format, so this function need not handle null values.
|
inline |
Parse a string representation of a value of a composite type.
You may use this as a helper while implementing your own string_traits for a composite type.
This function interprets text as the string representation of a value of some composite type, and sets each of fields to the respective values of its fields. The field types must be copy-assignable.
The number of fields must match the number of fields in the composite type, and there must not be any other text in the input. The function is meant to handle any value string that the backend can produce, but not necessarily every valid alternative spelling.
Fields in composite types can be null. When this happens, the C++ type of the corresponding field reference must be of a type that can handle nulls. If you are working with a type that does not have an inherent null value, such as e.g. int, consider using std::optional.
|
inline |
Simple way to execute a transaction with automatic retry.
Executes your transaction code as a callback. Repeats it until it completes normally, or it throws an error other than the few libpqxx-generated exceptions that the framework understands, or after a given number of failed attempts, or if the transaction ends in an "in-doubt" state.
(An in-doubt state is one where libpqxx cannot determine whether the server finally committed a transaction or not. This can happen if the network connection to the server is lost just while we're waiting for its reply to a "commit" statement. The server may have completed the commit, or not, but it can't tell you because there's no longer a connection.
Using this still takes a bit of care. If your callback makes use of data from the database, you'll probably have to query that data within your callback. If the attempt to perform your callback fails, and the framework tries again, you'll be in a new transaction and the data in the database may have changed under your feet.
Also be careful about changing variables or data structures from within your callback. The run may still fail, and perhaps get run again. The ideal way to do it (in most cases) is to return your result from your callback, and change your program's data state only after perform completes successfully.
| callback | Transaction code that can be called with no arguments. |
| attempts | Maximum number of times to attempt performing callback. Must be greater than zero. |
|
inline |
Simple way to execute a transaction with automatic retry.
Executes your transaction code as a callback. Repeats it until it completes normally, or it throws an error other than the few libpqxx-generated exceptions that the framework understands, or after a given number of failed attempts, or if the transaction ends in an "in-doubt" state.
(An in-doubt state is one where libpqxx cannot determine whether the server finally committed a transaction or not. This can happen if the network connection to the server is lost just while we're waiting for its reply to a "commit" statement. The server may have completed the commit, or not, but it can't tell you because there's no longer a connection.
Using this still takes a bit of care. If your callback makes use of data from the database, you'll probably have to query that data within your callback. If the attempt to perform your callback fails, and the framework tries again, you'll be in a new transaction and the data in the database may have changed under your feet.
Also be careful about changing variables or data structures from within your callback. The run may still fail, and perhaps get run again. The ideal way to do it (in most cases) is to return your result from your callback, and change your program's data state only after perform completes successfully.
| callback | Transaction code that can be called with no arguments. |
| attempts | Maximum number of times to attempt performing callback. Must be greater than zero. |
|
inlinenoexcept |
Wrapper for PQntuples() that deals in our placeholder types.
|
inlinenoexcept |
Cast a pqxx::internal::pq::PGresult pointer back to its real type.
There's really no such thing as a pqxx::internal::pq::PGresult. It's just a placeholder we use in our headers so we can talk about this type without actually importing its definition.
It's not a forward declaration though: before we can use these pointers, we have to cast them back to their original type. This does that.
|
inlinenoexcept |
Cast a pqxx::internal::pq::PGresult pointer back to its real type.
There's really no such thing as a pqxx::internal::pq::PGresult. It's just a placeholder we use in our headers so we can talk about this type without actually importing its definition.
It's not a forward declaration though: before we can use these pointers, we have to cast them back to their original type. This does that.
| pqxx::requires | ( | pqxx::internal::from_string_7< TYPE > or pqxx::internal::from_string_8< TYPE > | ) | const |
Is the libpqxx 8 version of from_string() supported for TYPE?
The pqxx::string_traits specialisation for TYPE must support either the 7.x to_buf API or the 8.x one.
| pqxx::requires | ( | pqxx::internal::to_buf_7< TYPE > or pqxx::internal::to_buf_8< TYPE > | ) | const |
Is the libpqxx 8 version of to_buf() supported for TYPE?
The pqxx::string_traits specialisation for TYPE must support either the 7.x to_buf API or the 8.x one.
The real reason this function exists is to make the compiler check for API compliance... and if necessary, give a helpful error message. For that, a requires is better than a static_assert(). However, we can't use it in the calling function's signature, since it requires a definition for the relevant specialisation of pqxx::string_traits before the calling function's. That complicates things.
|
inline |
Render items in a container as a string, using given separator.
|
inline |
Represent sequence of values as a string, joined by a given separator.
Use this to turn e.g. the numbers 1, 2, and 3 into a string "1, 2, 3".
| sep | separator string (to be placed between items) |
| begin | beginning of items sequence |
| end | end of items sequence |
| access | functor defining how to dereference sequence elements |
|
inline |
Render sequence as a string, using given separator between items.
|
inline |
Render items in a tuple as a string, using given separator.
|
inline |
|
inlineconstexprnoexcept |
Estimate how much buffer space is needed to represent values as a string.
The estimate may be a little pessimistic, if it saves time.
|
inlinenoexcept |
Control initialisation of OpenSSL and libcrypto libraries.
By default, libpq initialises the openssl and libcrypto libraries when your process first opens an SSL connection to a database. But this may not be what you want: perhaps your application (or some other library it uses) already initialises one or both of these libraries.
Call this function to stop libpq from initialising one or the other of these. Pass as arguments each of the skip_init flags for which of the libraries whose initialisation you want to prevent.
Examples:
skip_init_ssl<pqxx::skip_init::openssl>();skip_init_ssl<pqxx::skip_init::nothing>();
|
inline |
Convert multiple values to strings inside a single buffer.
There must be enough room for all values, or this will throw conversion_overrun. You can obtain a conservative estimate of the buffer space required by calling size_buffer() on the values.
The std::string_view results may point into the buffer, so don't assume that they will remain valid after you destruct or move the buffer.
|
inline |
Represent value as SQL text, optionally using buf as storage.
This calls string_traits<TYPE>::to_buf(), but bridges some API version differences.
|
inline |
Convert multiple values to strings inside a single buffer.
There must be enough room for all values, or this will throw conversion_overrun. You can obtain a conservative estimate of the buffer space required by calling size_buffer() on the values.
The std::string_view results may point into the buffer, so don't assume that they will remain valid after you destruct or move the buffer.
|
inline |
Convert multiple values to strings inside a single buffer.
There must be enough room for all values, or this will throw conversion_overrun. You can obtain a conservative estimate of the buffer space required by calling size_buffer() on the values.
The std::string_view results may point into the buffer, so don't assume that they will remain valid after you destruct or move the buffer.
std::source_location.
|
inline |
|
inline |
Convert a field to a string.
|
inline |
Convert a field_ref to a string.
|
inline |
|
inline |
|
inline |
|
inline |
Convert a value to a readable string that PostgreSQL will understand.
The conversion does no special formatting, and ignores any locale settings. The resulting string will be human-readable and in a format suitable for use in SQL queries. It won't have niceties such as "thousands separators" though.
|
inline |
Convert a value to a readable string that PostgreSQL will understand.
The conversion does no special formatting, and ignores any locale settings. The resulting string will be human-readable and in a format suitable for use in SQL queries. It won't have niceties such as "thousands separators" though.
|
inlineconstexpr |
Libpqxx ABI version string: major and minor version, but no patch.
For example, for libpqxx 9.3.1, this will be "9.3".
|
inlineconstexpr |
Element separator between SQL array elements of this type.
| concept pqxx::binary |
Concept: Binary string, akin to std::string for binary data.
Any type that satisfies this concept can represent an SQL BYTEA value.
A binary has a begin(), end(), size(), and @data(). Each byte is a std::byte, and they must all be laid out contiguously in memory so we can reference them by a pointer.
| concept pqxx::char_sized = (sizeof(CHAR) == 1) |
A type one byte in size.
| concept pqxx::char_string |
Concept: Any type that we can read as a string of char.
| concept pqxx::char_strings |
Concept: Anything we can iterate to get things we can read as strings.
| concept pqxx::enum_type = std::is_enum_v<E> |
Concept: A C++ enum type.
|
constexpr |
Pass this to a stream_from constructor to stream query results.
|
constexpr |
Pass this to a stream_from constructor to stream table contents.
| concept pqxx::has_equal = requires(T n) { n == n; } |
Concept: T supports equality comparison.
| concept pqxx::has_less = std::copy_constructible<T> and requires(T n) { n < n; } |
Concept: T supports copying, and less-than operator.
|
inlineconstexpr |
Does this type translate to an SQL array?
Specialisations may override this to be true for container types.
This may not always be a black-and-white choice. For instance, a std::string is a container, but normally it translates to an SQL string, not an SQL array.
|
inlineconstexpr |
|
inlineconstexpr |
Can we use this type in arrays and composite types without quoting them?
Define this as true only if values of TYPE can never contain any special characters that might need escaping or confuse the parsing of array or composite * types, such as commas, quotes, parentheses, braces, newlines, and so on.
When converting a value of such a type to a string in an array or a field in a composite type, we do not need to add quotes, nor escape any special characters.
This is just an optimisation, so it defaults to false to err on the side of slow correctness.
|
inlineconstexpr |
|
inlineconstexpr |
| concept pqxx::nonbinary_range |
A series of something that's not bytes.
| concept pqxx::not_borrowed |
Concept: A value that's not just a reference to values elsewhere.
This can be an important distinction when returning values. For example, if a function creates a std::string in a local variable, it can't then return a std::string_view referring to that string. By the time the caller gets to it, the underlying data is no longer valid.
In most cases these are decisions we make while writing code. But when converting data to a caller-selected type, there are situations where it's safe to return a view and there are situations where it's not.
|
constexpr |
The "null" oid.
| concept pqxx::potential_binary |
Concept: Anything we might want to treat as binary data.
| std::string const pqxx::type_name |
A human-readable name for a type, used in error messages and such.
Actually this may not always be very user-friendly. It uses std::type_info::name(). On gcc-like compilers we try to demangle its output. Visual Studio produces human-friendly names out of the box.
This variable is not inline. Inlining it gives rise to "memory leak" warnings from asan, the address sanitizer, possibly from use of std::type_info::name.
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
Full libpqxx version string.
|
inlineconstexpr |
Major libpqxx version number. (E.g. for libpqxx 9.3.1, this will be 9.)
|
inlineconstexpr |
Minor libpqxx version number. (E.g. for libpqxx 9.3.1, this will be 3.)
|
inlineconstexpr |
Libpqxx patch version number. (E.g. for libpqxx 9.3.1, this will be 1.)
For "special" versions such as pre-releases, the last component of the version string is not a simple number, and version_patch will be -1.
| concept pqxx::ZKey_ZValues |
Concept: T is a range of pairs of zero-terminated strings.
For example, this could be a std::map<char const *, std::string>, or a std::vector<std::pair<pqxx::zview, char const *>, or a std::array<std::array<std::string, 2>, 10>, etc.
The pairs have to be recognisable as pairs at compile time. It's not enough to pass a container of std::vector and ensure at run time that they each contain 2 elements.
| concept pqxx::ZString |
Concept: T is a known zero-terminated string type.
There's no unified API for these string types. It's just a check for some known types. Any code that makes use of the concept will still have to support each of these individually.