libpqxx
The C++ client library for PostgreSQL
pqxx::string_traits< char const * > Struct Referencefinal

String traits for C-style string ("pointer to char const"). More...

#include <conversions.hxx>

Static Public Member Functions

static char const * from_string (std::string_view text, ctx={})=delete
 
constexpr static PQXX_ZARGS std::string_view to_buf (std::span< char >, char const *const &value, ctx={}) noexcept
 
static constexpr PQXX_ZARGS std::size_t size_buffer (char const *value) noexcept
 

Detailed Description

String traits for C-style string ("pointer to char const").

This conversion is not bidirectional. You can convert a C-style string to an SQL string, but not the other way around.

The reason for this is the terminating zero. The incoming SQL string is a std::string_view, which may or may not have a zero at the end. (And there's no reliable way of checking, since the next memory position may not be a valid address. Even if there happens to be a zero there, it isn't necessarily part of the same block of mmory.)

Member Function Documentation

◆ from_string()

static char const* pqxx::string_traits< char const * >::from_string ( std::string_view  text,
ctx  = {} 
)
staticdelete

◆ size_buffer()

static constexpr PQXX_ZARGS std::size_t pqxx::string_traits< char const * >::size_buffer ( char const *  value)
inlinestaticconstexprnoexcept

◆ to_buf()

constexpr static PQXX_ZARGS std::string_view pqxx::string_traits< char const * >::to_buf ( std::span< char >  ,
char const *const &  value,
ctx  = {} 
)
inlinestaticconstexprnoexcept

The documentation for this struct was generated from the following file: