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

You cannot convert a char to/from SQL. More...

#include <strconv.hxx>

+ Inheritance diagram for pqxx::string_traits< char >:
+ Collaboration diagram for pqxx::string_traits< char >:

Additional Inherited Members

- Static Public Member Functions inherited from pqxx::forbidden_conversion< char >
static std::string_view to_buf (std::span< char >, char const &, ctx={})=delete
 
static char from_string (std::string_view, ctx={})=delete
 
static std::size_t size_buffer (char const &) noexcept=delete
 

Detailed Description

You cannot convert a char to/from SQL.

Converting this type may seem simple enough, but it's ambiguous: Did you mean the char value as a small integer? If so, did you mean it to be signed or unsigned? (The C++ Standard allows the system to implement char as either a signed type or an unsigned type.) Or were you thinking of a single-character string (and if so, using what encoding)? Or perhaps it's just a raw byte value?

If you meant it as an integer, use an appropriate integral type such as int or short or unsigned int etc.

If you wanted a single-character string, use std::string_view (or a similar type such as std::string).

Or if you had a raw byte in mind, try pqxx::bytes_view instead.


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