Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext
any_connection::set_character_set (2 of 2 overloads)

Sets the connection's character set, as per SET NAMES.

Synopsis
void
set_character_set(
    const character_set& charset);
Description

Sets the connection's character set by running a SET NAMES SQL statement, using the passed character_set::name as the charset name to set.

This function will also update the value returned by current_character_set, so prefer using this function over raw SQL statements.

If the server was unable to set the character set to the requested value (e.g. because the server does not support the requested charset), this function will fail, as opposed to how connect behaves when an unsupported collation is passed. This is a limitation of MySQL servers.

You need to perform connection establishment for this function to succeed, since it involves communicating with the server.

Object lifetimes

charset will be copied as required, and does not need to be kept alive.


PrevUpHomeNext