24#ifndef STRINGS_COLLATIONS_INTERNAL_H_
25#define STRINGS_COLLATIONS_INTERNAL_H_
31#include <unordered_map>
46namespace collation_internals {
48using id_hash_map = std::unordered_map<unsigned, CHARSET_INFO *>;
52 [[nodiscard]]
size_t operator()(std::string_view txt)
const {
53 return std::hash<std::string_view>{}(txt);
static Mysys_charset_loader * loader
Definition: charset.cc:185
User-specified callback interface for collation parser/initializer.
Definition: m_ctype.h:189
Normalizes character set/collation names.
Definition: collations.h:64
Helper class: implementation of character set/collation library.
Definition: collations_internal.h:65
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.
Definition: collations_internal.cc:689
MY_CHARSET_LOADER * m_loader
Shared MY_CHARSET_LOADER implementation for use in collation parser and initializer.
Definition: collations_internal.h:297
CHARSET_INFO * find_by_name_unsafe(const mysql::collation::Name &name)
Like find_by_name but without initialization of return value.
Definition: collations_internal.cc:763
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.
Definition: collations_internal.cc:660
sv_hash_map m_all_by_collation_name
Maps normalized strings of all known character set names, collation names, and their aliases to CHARS...
Definition: collations_internal.h:266
id_hash_map m_all_by_id
Maps collation ids to CHARSET_INFO object pointers.
Definition: collations_internal.h:257
void iterate(const std::function< void(const CHARSET_INFO *)> &f)
Iterate over all collation objects known to the library.
Definition: collations_internal.h:224
CHARSET_INFO * find_by_name(const mysql::collation::Name &name, myf flags=0, MY_CHARSET_ERRMSG *errmsg=nullptr)
Finds collation by its name.
Definition: collations_internal.cc:648
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.
Definition: collations_internal.cc:682
Collations(const Collations &)=delete
const std::string m_charset_dir
Optional '/'-terminated path to the directory containing Index.xml.
Definition: collations_internal.h:252
~Collations()
Definition: collations_internal.cc:636
CHARSET_INFO * unsafe_init(CHARSET_INFO *cs, myf flags, MY_CHARSET_ERRMSG *errmsg)
Internals of safe_init_when_necessary()
Definition: collations_internal.cc:712
Collations & operator=(const Collations &)=delete
std::mutex m_mutex
Collation parser/initializer mutex.
Definition: collations_internal.h:307
sv_hash_map m_primary_by_cs_name
Maps normalized strings of character set names to CHARSET_INFO object pointers.
Definition: collations_internal.h:275
unsigned get_collation_id(const mysql::collation::Name &name) const
Finds collation by its name and returns its id.
Definition: collations_internal.cc:675
sv_hash_map m_binary_by_cs_name
Maps normalized strings of character set names to CHARSET_INFO objects of preferred binary collations...
Definition: collations_internal.h:284
bool add_internal_collation(CHARSET_INFO *cs)
For registering compile-time collations.
Definition: collations_internal.cc:734
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.
Definition: collations_internal.cc:667
CHARSET_INFO * find_by_id(unsigned id, myf flags=0, MY_CHARSET_ERRMSG *errmsg=nullptr)
Finds collation by its number.
Definition: collations_internal.cc:655
const bool m_owns_loader
False if m_loader references external MY_CHARSET_LOADER, otherwise true.
Definition: collations_internal.h:289
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.
Definition: collations_internal.cc:696
int myf
Definition: collations_internal.h:38
constexpr char MY_CHARSET_INDEX[]
Definition: collations_internal.h:36
static int flags[50]
Definition: hp_test1.cc:40
A better implementation of the UNIX ctype(3) library.
int myf
Definition: my_inttypes.h:94
const char * collation
Definition: audit_api_message_emit.cc:184
Definition: commit_order_queue.h:34
std::unordered_map< unsigned, CHARSET_INFO * > id_hash_map
Definition: collations_internal.h:48
std::unordered_map< std::string, CHARSET_INFO *, string_hash, std::equal_to<> > sv_hash_map
Definition: collations_internal.h:58
Collations * entry
Global entry point to character set/collation library internals.
Definition: collations_internal.cc:43
Definition: instrumented_condition_variable.h:32
std::unordered_map< Key, Value, Hash, Key_equal, ut::allocator< std::pair< const Key, Value > > > unordered_map
Definition: ut0new.h:2900
Definition: m_ctype.h:421
Helper structure to return error messages from collation parser/initializer.
Definition: m_ctype.h:180
Definition: collations_internal.h:50
void is_transparent
Definition: collations_internal.h:51
size_t operator()(std::string_view txt) const
Definition: collations_internal.h:52