![]() |
MySQL 9.3.0
Source Code Documentation
|
Helper class: implementation of character set/collation library. More...
#include <collations_internal.h>
Public Member Functions | |
Collations (const Collations &)=delete | |
Collations & | operator= (const Collations &)=delete |
Collations (const char *charset_dir, MY_CHARSET_LOADER *loader=nullptr) | |
Constructor. More... | |
~Collations () | |
CHARSET_INFO * | find_by_name (const mysql::collation::Name &name, myf flags=0, MY_CHARSET_ERRMSG *errmsg=nullptr) |
Finds collation by its name. More... | |
CHARSET_INFO * | find_by_id (unsigned id, myf flags=0, MY_CHARSET_ERRMSG *errmsg=nullptr) |
Finds collation by its number. More... | |
CHARSET_INFO * | find_primary (const mysql::collation::Name &cs_name, myf flags=0, MY_CHARSET_ERRMSG *errmsg=nullptr) |
Finds primary collation by its character set name. More... | |
CHARSET_INFO * | find_default_binary (const mysql::collation::Name &cs_name, myf flags=0, MY_CHARSET_ERRMSG *errmsg=nullptr) |
Finds binary collation by its character set name. More... | |
unsigned | get_collation_id (const mysql::collation::Name &name) const |
Finds collation by its name and returns its id. More... | |
unsigned | get_primary_collation_id (const mysql::collation::Name &name) const |
Finds character set by its name and returns an id of its primary collation. More... | |
unsigned | get_default_binary_collation_id (const mysql::collation::Name &name) const |
Finds character set by its name and returns an id of its default binary collation. More... | |
CHARSET_INFO * | safe_init_when_necessary (CHARSET_INFO *cs, myf flags=0, MY_CHARSET_ERRMSG *errmsg=nullptr) |
If not done yet, force collation parsing/initialization under m_mutex lock. More... | |
CHARSET_INFO * | find_by_name_unsafe (const mysql::collation::Name &name) |
Like find_by_name but without initialization of return value. More... | |
bool | add_internal_collation (CHARSET_INFO *cs) |
For registering compile-time collations. More... | |
void | iterate (const std::function< void(const CHARSET_INFO *)> &f) |
Iterate over all collation objects known to the library. More... | |
Protected Member Functions | |
CHARSET_INFO * | unsafe_init (CHARSET_INFO *cs, myf flags, MY_CHARSET_ERRMSG *errmsg) |
Internals of safe_init_when_necessary() More... | |
Protected Attributes | |
const std::string | m_charset_dir |
Optional '/'-terminated path to the directory containing Index.xml. More... | |
id_hash_map | m_all_by_id |
Maps collation ids to CHARSET_INFO object pointers. More... | |
sv_hash_map | m_all_by_collation_name |
Maps normalized strings of all known character set names, collation names, and their aliases to CHARSET_INFO object pointers. More... | |
sv_hash_map | m_primary_by_cs_name |
Maps normalized strings of character set names to CHARSET_INFO object pointers. More... | |
sv_hash_map | m_binary_by_cs_name |
Maps normalized strings of character set names to CHARSET_INFO objects of preferred binary collations. More... | |
const bool | m_owns_loader |
False if m_loader references external MY_CHARSET_LOADER, otherwise true. More... | |
MY_CHARSET_LOADER * | m_loader |
Shared MY_CHARSET_LOADER implementation for use in collation parser and initializer. More... | |
Private Attributes | |
std::mutex | m_mutex |
Collation parser/initializer mutex. More... | |
Helper class: implementation of character set/collation library.
|
delete |
|
explicit |
Constructor.
charset_dir | Optional "/\0"-terminated path to the directory containing Index.xml |
loader | Optional user-specified hooks to the character set/collation parser/initializer. |
mysql::collation_internals::Collations::~Collations | ( | ) |
bool mysql::collation_internals::Collations::add_internal_collation | ( | CHARSET_INFO * | cs | ) |
For registering compile-time collations.
cs | Collation object |
CHARSET_INFO * mysql::collation_internals::Collations::find_by_id | ( | unsigned | id, |
myf | flags = 0 , |
||
MY_CHARSET_ERRMSG * | errmsg = nullptr |
||
) |
Finds collation by its number.
id | Collation id (hardcoded in library sources or specified in Index.xml) | |
flags | Optional mysys-specific flags | |
[out] | errmsg | Optional buffer to return error message from collation parser/initializer |
CHARSET_INFO * mysql::collation_internals::Collations::find_by_name | ( | const mysql::collation::Name & | name, |
myf | flags = 0 , |
||
MY_CHARSET_ERRMSG * | errmsg = nullptr |
||
) |
Finds collation by its name.
name | Collation name | |
flags | Optional mysys-specific flags | |
[out] | errmsg | Optional buffer to return error message from collation parser/initializer |
CHARSET_INFO * mysql::collation_internals::Collations::find_by_name_unsafe | ( | const mysql::collation::Name & | name | ) |
Like find_by_name but without initialization of return value.
name | Collation name |
CHARSET_INFO * mysql::collation_internals::Collations::find_default_binary | ( | const mysql::collation::Name & | cs_name, |
myf | flags = 0 , |
||
MY_CHARSET_ERRMSG * | errmsg = nullptr |
||
) |
Finds binary collation by its character set name.
cs_name | Character set name | |
flags | Optional mysys-specific flags | |
[out] | errmsg | Optional buffer to return error message from collation parser/initializer |
CHARSET_INFO * mysql::collation_internals::Collations::find_primary | ( | const mysql::collation::Name & | cs_name, |
myf | flags = 0 , |
||
MY_CHARSET_ERRMSG * | errmsg = nullptr |
||
) |
Finds primary collation by its character set name.
cs_name | Character set name | |
flags | Optional mysys-specific flags | |
[out] | errmsg | Optional buffer to return error message from collation parser/initializer |
unsigned mysql::collation_internals::Collations::get_collation_id | ( | const mysql::collation::Name & | name | ) | const |
Finds collation by its name and returns its id.
name | Collation name |
unsigned mysql::collation_internals::Collations::get_default_binary_collation_id | ( | const mysql::collation::Name & | name | ) | const |
Finds character set by its name and returns an id of its default binary collation.
name | Collation name |
unsigned mysql::collation_internals::Collations::get_primary_collation_id | ( | const mysql::collation::Name & | name | ) | const |
Finds character set by its name and returns an id of its primary collation.
name | Collation name |
|
inline |
Iterate over all collation objects known to the library.
f | Closure to execute on each collation object known to the library |
|
delete |
CHARSET_INFO * mysql::collation_internals::Collations::safe_init_when_necessary | ( | CHARSET_INFO * | cs, |
myf | flags = 0 , |
||
MY_CHARSET_ERRMSG * | errmsg = nullptr |
||
) |
If not done yet, force collation parsing/initialization under m_mutex lock.
cs | Pointer to collation object | |
flags | Optional mysys-specific flags | |
[out] | errmsg | Optional buffer to return error message from collation parser/initializer |
cs
on success, otherwise nullptr
|
protected |
Internals of safe_init_when_necessary()
This function is similar to safe_init_when_necessary, but, unlike safe_init_when_necessary(), it doesn't acquire locks.
cs | Pointer to collation object | |
flags | Optional mysys-specific flags | |
[out] | errmsg | Optional buffer to return error message from collation parser/initializer |
cs
on success, otherwise nullptr
|
protected |
Maps normalized strings of all known character set names, collation names, and their aliases to CHARSET_INFO object pointers.
|
protected |
Maps collation ids to CHARSET_INFO object pointers.
|
protected |
Maps normalized strings of character set names to CHARSET_INFO objects of preferred binary collations.
|
protected |
Optional '/'-terminated path to the directory containing Index.xml.
|
protected |
Shared MY_CHARSET_LOADER implementation for use in collation parser and initializer.
By default references an instance of mysql::collation_internals::Loader.
|
private |
Collation parser/initializer mutex.
The library parses collations and initializes CHARSET_INFO objects in depth on demand, so m_mutex is necessary to guarantee a safety of concurrent find_... function calls.
|
protected |
False if m_loader references external MY_CHARSET_LOADER, otherwise true.
|
protected |
Maps normalized strings of character set names to CHARSET_INFO object pointers.