|
libpqxx
The C++ client library for PostgreSQL
|
Contextual parameters for string conversions implementations. More...
#include <strconv.hxx>
Public Member Functions | |
| constexpr | conversion_context (sl lc=sl::current()) |
| constexpr | conversion_context (encoding_group e, sl l=sl::current()) |
Public Attributes | |
| encoding_group | enc = encoding_group::unknown |
| Encoding group describing the client text encoding. More... | |
| sl | loc = sl::current() |
A std::source_location for the call. More... | |
Contextual parameters for string conversions implementations.
These are some "extra" items that libpqxx may be able to pass to a string conversion operation in order to provide it with extra information.
Yes, these could simply have been extra parameters in the conversion API, but that makes it harder to add new features (which existing conversions can often safely ignore) without breaking compatibility.
This type was introduced in libpqxx 8. The older conversion API does not know about it, so older code will just have a default-constructed context.
|
inlineconstexpr |
|
inlineexplicitconstexpr |
| encoding_group pqxx::conversion_context::enc = encoding_group::unknown |
Encoding group describing the client text encoding.
This will not tell you what the exact encoding is. All libpqxx cares about is how to parse text in a given encoding, so that it can reliably detect escape characters, closing quotes, and so on. It has no need to "understand" the text beyond that.
| sl pqxx::conversion_context::loc = sl::current() |
A std::source_location for the call.
When libpqxx throws an error, it will generally try to include this information to help you debug the problem. However this is not always possible.
Generally it will be helpful to pass the location where the client called into libpqxx. However if you don't pass a source location, this will use the location in the source code where you created this ctx.