31#ifndef MYSQLX_COLLATIONS_H
32#define MYSQLX_COLLATIONS_H
41#include "mysql_charsets.h"
42#include "mysql_collations.h"
55enum class CharacterSet :
unsigned short
58 #define CS_ENUM(CS) CS,
63#define CS_NAME_SWITCH(CS) case CharacterSet::CS: return #CS;
76 CDK_CS_LIST(CS_NAME_SWITCH)
78 THROW(
"Unknown character set id");
99 unsigned id()
const {
return m_id; }
103 const char *getName()
const {
return m_name; }
107 CharacterSet getCharacterSet()
const {
return m_cs; }
118 bool isBinary()
const {
return m_case == case_bin; }
121 bool operator==(
const CollationInfo &other)
const
123 return m_id == other.m_id;
126 bool operator!=(
const CollationInfo &other)
const
128 return !operator==(other);
133 enum coll_case { case_bin, case_ci, case_cs };
147template <CharacterSet CS>
struct Collation;
176#define COLL_DECL(CS) \
177template<> struct Collation<CharacterSet::CS> \
178{ COLLATIONS_##CS(COLL_CONST) }; \
180#define COLL_CONST(CS,ID,COLL,CASE) \
181static PUBLIC_API const CollationInfo COLL_CONST_NAME(COLL,CASE);
183#define COLL_CONST_NAME(COLL,CASE) COLL_CONST_NAME_##CASE(COLL)
185#define COLL_CONST_NAME_bin(COLL) COLL
186#define COLL_CONST_NAME_ci(COLL) COLL##_ci
187#define COLL_CONST_NAME_ai_ci(COLL) COLL##_ai_ci
188#define COLL_CONST_NAME_cs(COLL) COLL##_cs
189#define COLL_CONST_NAME_as_cs(COLL) COLL##_as_cs
190#define COLL_CONST_NAME_as_ci(COLL) COLL##_as_ci
191#define COLL_CONST_NAME_as_cs_ks(COLL) COLL##_as_cs_ks
195#undef COLLATIONS_utf8mb4_EXTRA
196#define COLLATIONS_utf8mb4_EXTRA \
197static PUBLIC_API const CollationInfo utf8mb4;
199CDK_CS_LIST(COLL_DECL)
201#undef COLLATIONS_utf8mb4_EXTRA
202#define COLLATIONS_utf8mb4_EXTRA
const char * characterSetName(CharacterSet id)
Returns name of a character set given by its id.
Definition: collations.h:71
Structure that provides information about character set collation.
Definition: collations.h:94
bool isCaseSensitive() const
Returns true if given collation is case sensitive.
Definition: collations.h:112
bool isBinary() const
Returns true if this is binary collation.
Definition: collations.h:116