libpqxx
The C++ client library for PostgreSQL
|
You cannot convert a char to/from SQL. More...
Static Public Member Functions | |
static zview | to_buf (char *begin, char *end, char const &value) |
Return a string_view representing value, plus terminating zero. | |
static char * | into_buf (char *begin, char *end, char const &value) |
Write value's string representation into buffer at begin . | |
static char | from_string (std::string_view text) |
Parse a string representation of a TYPE value. | |
static std::size_t | size_buffer (char const &value) noexcept |
Estimate how much buffer space is needed to represent value. | |
Static Public Member Functions inherited from pqxx::forbidden_conversion< char > | |
static zview | to_buf (char *, char *, char const &) |
static char * | into_buf (char *, char *, char const &) |
static char | from_string (std::string_view) |
static std::size_t | size_buffer (char const &) noexcept |
Static Public Attributes | |
static constexpr bool | converts_to_string |
Is conversion from TYPE to strings supported? | |
static constexpr bool | converts_from_string |
Is conversion from string_view to TYPE supported? | |
Static Public Attributes inherited from pqxx::forbidden_conversion< char > | |
static constexpr bool | converts_to_string |
static constexpr bool | converts_from_string |
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.
|
inlinestaticnodiscard |
Parse a string representation of a TYPE
value.
Throws conversion_error
if value
does not meet the expected format for a value of this type.
|
inlinestaticnodiscardnoexcept |
Estimate how much buffer space is needed to represent value.
The estimate may be a little pessimistic, if it saves time.
The estimate includes the terminating zero.
|
inlinestaticnodiscard |
Return a string_view
representing value, plus terminating zero.
Produces a string_view
containing the PostgreSQL string representation for value
.
Uses the space from begin
to end
as a buffer, if needed. The returned string may lie somewhere in that buffer, or it may be a compile-time constant, or it may be null if value was a null value. Even if the string is stored in the buffer, its begin()
may or may not be the same as begin
.
The string_view
is guaranteed to be valid as long as the buffer from begin
to end
remains accessible and unmodified.
pqxx::conversion_overrun | if the provided buffer space may not be enough. For maximum performance, this is a conservative estimate. It may complain about a buffer which is actually large enough for your value, if an exact check gets too expensive. |
|
staticconstexpr |
Is conversion from string_view to TYPE supported?
When defining your own conversions, specialise this as true to indicate that your string traits support from_string.
|
staticconstexpr |
Is conversion from TYPE to strings supported?
When defining your own conversions, specialise this as true to indicate that your string traits support the conversions to strings.