...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Returns the character set used by this connection.
system::result< character_set > current_character_set() const;
Connections attempt to keep track of the current character set. Deficiencies
in the protocol can cause the character set to be unknown, though. When
the character set is known, this function returns the character set currently
in use. Otherwise, returns client_errc::unknown_character_set
.
The following functions can modify the return value of this function:
connect
and async_connect
may set the
current character set to a known value, depending on the requested
collation.
set_character_set
always and
async_set_character_set
always
set the current character set to the passed value.
reset_connection
and async_reset_connection
always
makes the current character unknown.
If you change the connection's character set directly using SQL statements
like "SET NAMES utf8mb4"
,
the client has no way to track this change, and this function will return
incorrect results.
client_errc::unknown_character_set
if the current character set is unknown.
No-throw guarantee.