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

pool_charset_strategy
PrevUpHomeNext

Describes how pooled connections manage their character set.

Synopsis

Defined in header <boost/mysql/pool_params.hpp>

class pool_charset_strategy;
Member Functions

Name

Description

pool_charset_strategy [constructor]

Default constructor, equivalent to set_to_utf8mb4.

server_default_charset

Retrieves the server's default character set.

type

Retrieves the kind of strategy represented by this object.

Static Member Functions

Name

Description

set_to_utf8mb4

Creates a strategy that makes pooled connections use utf8mb4.

use_server_default

Creates a strategy that makes pooled connections use the server's default character set.

Description

This is a lightweight variant-like type that determines how connections in a pool set its character set and restore it when they are returned to the pool. Create instances using the set_to_utf8mb4 and use_server_default factory functions.

  • When using set_to_utf8mb4 (the default), connections are established using a collation ID of utf8mb4_general_ci, and a SET NAMES statement is issued after returning them to the pool and resetting them. The character set is always known and equal to utf8mb4.
  • When using use_server_default, connections are established using invalid_collation_id as collation ID, causing them to use the server's default. No SET NAMES statement is issued after resetting the connections, causing them again to use the server's default. When using this value, you must provide the server's default character set as an argument, and it must match what is actually configured in the server (no runtime check is performed). This option should only be used as an optimization, and if you know what you are doing.

Convenience header <boost/mysql.hpp>


PrevUpHomeNext