...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Resets server-side session state, like variables and prepared statements.
void reset_connection();
Resets all server-side state for the current session:
SET NAMES
) and clears all user-defined
variables.
A full reference on the affected session state can be found here.
This function will not reset the current physical connection and won't cause re-authentication. It is faster than closing and re-opening a connection.
The connection must be connected and authenticated before calling this function. This function involves communication with the server, and thus may fail.
This function will restore the connection's character set and collation
to the server's default, and not to
the one specified during connection establishment. Some servers have
latin1
as their default
character set, which is not usually what you want. Since there is no
way to know this character set, current_character_set
will return
nullptr
after the operation
succeeds. We recommend always using set_character_set
or async_set_character_set
after
calling this function.
You can find the character set that your server will use after the reset by running:
"SELECT @@global.character_set_client, @@global.character_set_results;"