libpqxx  7.2.0
pqxx::internal Namespace Reference

Private namespace for libpqxx's internal use; do not access. More...

Namespaces

 gate
 

Classes

class  basic_robusttransaction
 Helper base class for the robusttransaction class template. More...
 
class  basic_transaction
 Helper base class for the transaction class template. More...
 
struct  enum_traits
 Helper class for defining enum conversions. More...
 
class  namedclass
 Helper base class: object descriptions for error messages and such. More...
 
class  result_iter
 
class  unique
 Ensure proper opening/closing of GUEST objects related to a "host" object. More...
 

Functions

void wait_read (internal::pq::PGconn const *)
 
void wait_read (internal::pq::PGconn const *, std::time_t seconds, long microseconds)
 
void wait_write (internal::pq::PGconn const *)
 
void clear_result (pq::PGresult const *)
 C++ wrapper for libpq's PQclear. More...
 
std::string demangle_type_name (char const [])
 Attempt to demangle std::type_info::name() to something human-readable. More...
 
void check_unique_registration (namedclass const *new_ptr, namedclass const *old_ptr)
 
void check_unique_unregistration (namedclass const *new_ptr, namedclass const *old_ptr)
 
constexpr std::size_t size_esc_bin (std::size_t binary_bytes) noexcept
 Compute buffer size needed to escape binary data for use as a BYTEA. More...
 
constexpr std::size_t size_unesc_bin (std::size_t escaped_bytes) noexcept
 Compute binary size from the size of its escaped version. More...
 
void esc_bin (std::string_view binary_data, char buffer[]) noexcept
 Hex-escape binary data into a buffer. More...
 
std::string esc_bin (std::string_view binary_data)
 Hex-escape binary data into a std::string. More...
 
void unesc_bin (std::string_view escaped_data, std::byte buffer[])
 Reconstitute binary data from its escaped version. More...
 
std::string unesc_bin (std::string_view escaped_data)
 Reconstitute binary data from its escaped version. More...
 
int PQXX_VERSION_CHECK () noexcept
 Library version check stub. More...
 
constexpr char const * as_c_string (char const str[]) noexcept
 Get a raw C string pointer. More...
 
template<std::size_t N>
constexpr char const * as_c_string (char(&str)[N]) noexcept
 Get a raw C string pointer. More...
 
constexpr char const * as_c_string (pqxx::zview str) noexcept
 Get a raw C string pointer. More...
 
char const * as_c_string (std::string const &str) noexcept
 Get a raw C string pointer. More...
 
PQXX_PURE char const * name_encoding (int encoding_id)
 
encoding_group enc_group (int libpq_enc_id)
 
encoding_group enc_group (std::string_view encoding_name)
 
template<template< encoding_group > class T, typename F >
constexpr F * for_encoding (encoding_group enc)
 Look up instantiation T<enc>::call at runtime. More...
 
PQXX_PURE glyph_scanner_func * get_glyph_scanner (encoding_group enc)
 
PQXX_PURE std::string::size_type find_with_encoding (encoding_group enc, std::string_view haystack, char needle, std::string::size_type start)
 
PQXX_PURE std::string::size_type find_with_encoding (encoding_group enc, std::string_view haystack, std::string_view needle, std::string::size_type start)
 
void throw_null_conversion (std::string const &type)
 
std::string state_buffer_overrun (int have_bytes, int need_bytes)
 
template<typename F >
std::string to_dumb_stringstream (dumb_stringstream< F > &s, F value)
 
template<typename T >
std::string to_string_float (T value)
 Floating-point implementations for pqxx::to_string(). More...
 
template std::string to_string_float (float)
 
template std::string to_string_float (double)
 
template std::string to_string_float (long double)
 

Variables

constexpr char empty_composite_str [] {"()"}
 
template<pqxx::isolation_level isolation, pqxx::write_policy rw>
const zview begin_cmd
 The SQL command for starting a given type of transaction. More...
 

Detailed Description

Private namespace for libpqxx's internal use; do not access.

This namespace hides definitions internal to libpqxx. These are not supposed to be used by client programs, and they may change at any time without notice.

Conversely, if you find something in this namespace tremendously useful, by all means do lodge a request for its publication.

Warning
Here be dragons!

Version check.

Copyright (c) 2000-2020, 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.

Function Documentation

◆ as_c_string() [1/4]

constexpr char const* pqxx::internal::as_c_string ( char const  str[])
noexcept

Get a raw C string pointer.

References as_c_string().

Referenced by as_c_string(), and pqxx::connection::quote().

◆ as_c_string() [2/4]

template<std::size_t N>
constexpr char const* pqxx::internal::as_c_string ( char(&)  str[N])
noexcept

Get a raw C string pointer.

References as_c_string().

◆ as_c_string() [3/4]

constexpr char const* pqxx::internal::as_c_string ( pqxx::zview  str)
noexcept

Get a raw C string pointer.

References as_c_string().

◆ as_c_string() [4/4]

char const* pqxx::internal::as_c_string ( std::string const &  str)
noexcept

Get a raw C string pointer.

References as_c_string().

◆ check_unique_registration()

void pqxx::internal::check_unique_registration ( namedclass const *  new_ptr,
namedclass const *  old_ptr 
)

◆ check_unique_unregistration()

void pqxx::internal::check_unique_unregistration ( namedclass const *  new_ptr,
namedclass const *  old_ptr 
)

◆ clear_result()

void pqxx::internal::clear_result ( pq::PGresult const *  data)

C++ wrapper for libpq's PQclear.

References pqxx::result::result().

Referenced by pqxx::result::table_column().

◆ demangle_type_name()

std::string pqxx::internal::demangle_type_name ( char const  raw[])

Attempt to demangle std::type_info::name() to something human-readable.

◆ enc_group() [1/2]

encoding_group pqxx::internal::enc_group ( int  libpq_enc_id)

◆ enc_group() [2/2]

encoding_group pqxx::internal::enc_group ( std::string_view  encoding_name)

◆ esc_bin() [1/2]

void pqxx::internal::esc_bin ( std::string_view  binary_data,
char  buffer[] 
)
noexcept

Hex-escape binary data into a buffer.

The buffer must be able to accommodate size_esc_bin(std::size(binary_data)) bytes, and the function will write exactly that number of bytes into the buffer. This includes a trailing zero.

Referenced by esc_bin(), pqxx::connection::esc_raw(), pqxx::string_traits< binarystring >::into_buf(), and size_unesc_bin().

◆ esc_bin() [2/2]

std::string pqxx::internal::esc_bin ( std::string_view  binary_data)

Hex-escape binary data into a std::string.

References esc_bin(), and size_esc_bin().

◆ find_with_encoding() [1/2]

PQXX_PURE std::string::size_type pqxx::internal::find_with_encoding ( encoding_group  enc,
std::string_view  haystack,
char  needle,
std::string::size_type  start 
)

◆ find_with_encoding() [2/2]

PQXX_PURE std::string::size_type pqxx::internal::find_with_encoding ( encoding_group  enc,
std::string_view  haystack,
std::string_view  needle,
std::string::size_type  start 
)

◆ for_encoding()

template<template< encoding_group > class T, typename F >
constexpr F* pqxx::internal::for_encoding ( encoding_group  enc)

Look up instantiation T<enc>::call at runtime.

Here, "T" is a struct template with a static member function "call", whose type is "F".

The return value is a pointer to the "call" member function for the instantiation of T for encoding group enc.

References pqxx::to_string().

◆ get_glyph_scanner()

PQXX_PURE glyph_scanner_func* pqxx::internal::get_glyph_scanner ( encoding_group  enc)

Referenced by pqxx::parse_composite().

◆ name_encoding()

PQXX_PURE char const* pqxx::internal::name_encoding ( int  encoding_id)

◆ PQXX_VERSION_CHECK()

int pqxx::internal::PQXX_VERSION_CHECK ( )
noexcept

Library version check stub.

Helps detect version mismatches between libpqxx headers and the libpqxx library binary.

Sometimes users run into trouble linking their code against libpqxx because they build their own libpqxx, but the system also has a different version installed. The declarations in the headers against which they compile their code will differ from the ones used to build the libpqxx version they're using, leading to confusing link errors. The solution is to generate a link error when the libpqxx binary is not the same version as the libpqxx headers used to compile the code.

This function's definition is in the libpqxx binary, so it's based on the version as found in the binary. The headers contain a call to the function, whose name contains the libpqxx version as found in the headers. (The library build process will use its own local headers even if another version of the headers is installed on the system.)

If the libpqxx binary was compiled for a different version than the user's code, linking will fail with an error: check_library_version will not exist for the given version number.

Referenced by pqxx::check_version().

◆ size_esc_bin()

constexpr std::size_t pqxx::internal::size_esc_bin ( std::size_t  binary_bytes)
noexcept

Compute buffer size needed to escape binary data for use as a BYTEA.

This uses the hex-escaping format. The return value includes room for the "\x" prefix.

References size_esc_bin().

Referenced by esc_bin(), pqxx::string_traits< binarystring >::size_buffer(), and size_esc_bin().

◆ size_unesc_bin()

constexpr std::size_t pqxx::internal::size_unesc_bin ( std::size_t  escaped_bytes)
noexcept

Compute binary size from the size of its escaped version.

Do not include a terminating zero in escaped_bytes.

References esc_bin(), size_unesc_bin(), and unesc_bin().

Referenced by pqxx::string_traits< binarystring >::from_string(), size_unesc_bin(), and unesc_bin().

◆ state_buffer_overrun()

std::string pqxx::internal::state_buffer_overrun ( int  have_bytes,
int  need_bytes 
)

References to_string_float().

◆ throw_null_conversion()

void pqxx::internal::throw_null_conversion ( std::string const &  type)

◆ to_dumb_stringstream()

template<typename F >
std::string pqxx::internal::to_dumb_stringstream ( dumb_stringstream< F > &  s,
value 
)

Referenced by to_string_float().

◆ to_string_float() [1/4]

template<typename T >
std::string pqxx::internal::to_string_float ( value)

Floating-point implementations for pqxx::to_string().

References pqxx::from_string(), pqxx::size_buffer(), and to_dumb_stringstream().

Referenced by state_buffer_overrun().

◆ to_string_float() [2/4]

template std::string pqxx::internal::to_string_float ( float  )

◆ to_string_float() [3/4]

template std::string pqxx::internal::to_string_float ( double  )

◆ to_string_float() [4/4]

template std::string pqxx::internal::to_string_float ( long  double)

◆ unesc_bin() [1/2]

void pqxx::internal::unesc_bin ( std::string_view  escaped_data,
std::byte  buffer[] 
)

Reconstitute binary data from its escaped version.

Referenced by pqxx::string_traits< binarystring >::from_string(), size_unesc_bin(), unesc_bin(), and pqxx::connection::unesc_raw().

◆ unesc_bin() [2/2]

std::string pqxx::internal::unesc_bin ( std::string_view  escaped_data)

Reconstitute binary data from its escaped version.

References size_unesc_bin(), and unesc_bin().

◆ wait_read() [1/2]

void pqxx::internal::wait_read ( internal::pq::PGconn const *  c)

◆ wait_read() [2/2]

void pqxx::internal::wait_read ( internal::pq::PGconn const *  c,
std::time_t  seconds,
long  microseconds 
)

References pqxx::check_cast().

◆ wait_write()

void pqxx::internal::wait_write ( internal::pq::PGconn const *  c)

References wait_read().

Referenced by pqxx::connection::quote().

Variable Documentation

◆ begin_cmd

template<pqxx::isolation_level isolation, pqxx::write_policy rw>
const zview pqxx::internal::begin_cmd

The SQL command for starting a given type of transaction.

◆ empty_composite_str

constexpr char pqxx::internal::empty_composite_str[] {"()"}