28
28
CollationsTool::CollationsTool() :
29
CharacterSetsTool("COLLATIONS")
29
plugin::TableFunction("DATA_DICTIONARY", "COLLATIONS")
31
31
add_field("CHARACTER_SET_NAME");
32
32
add_field("COLLATION_NAME");
33
33
add_field("DESCRIPTION");
34
add_field("ID", plugin::TableFunction::NUMBER, 0, false);
34
add_field("ID", plugin::TableFunction::NUMBER);
35
35
add_field("IS_DEFAULT", plugin::TableFunction::BOOLEAN);
36
36
add_field("IS_COMPILED", plugin::TableFunction::BOOLEAN);
37
add_field("SORTLEN", plugin::TableFunction::NUMBER, 0, false);
37
add_field("SORTLEN", plugin::TableFunction::NUMBER);
40
40
CollationsTool::Generator::Generator(Field **arg) :
41
CharacterSetsTool::Generator(arg),
42
is_collation_primed(false)
47
bool CollationsTool::Generator::end()
49
return collation_iter == all_charsets+255;
53
bool CollationsTool::Generator::check()
55
const CHARSET_INFO *tmp_cs= character_set();
56
const CHARSET_INFO *tmp_cl= collation();
59
not (tmp_cl->state & MY_CS_AVAILABLE) ||
60
not my_charset_same(tmp_cs, tmp_cl))
41
plugin::TableFunction::Generator(arg)
47
bool CollationsTool::Generator::populate()
49
for (; cs < all_charsets+255 ; cs++)
51
const CHARSET_INFO *tmp_cs= cs[0];
53
if (! tmp_cs || ! (tmp_cs->state & MY_CS_AVAILABLE) ||
54
(tmp_cs->state & MY_CS_HIDDEN) ||
55
!(tmp_cs->state & MY_CS_PRIMARY))
58
for (; cl < all_charsets+255 ;cl ++)
60
const CHARSET_INFO *tmp_cl= cl[0];
62
if (! tmp_cl || ! (tmp_cl->state & MY_CS_AVAILABLE) ||
63
!my_charset_same(tmp_cs, tmp_cl))
67
/* CHARACTER_SET_NAME */
70
/* "COLLATION_NAME" */
77
push((int64_t) tmp_cl->number);
80
push((bool)(tmp_cl->state & MY_CS_PRIMARY));
83
push((bool)(tmp_cl->state & MY_CS_COMPILED));
86
push((int64_t) tmp_cl->strxfrm_multiply);
66
bool CollationsTool::Generator::nextCollationCore()
74
if (not isCharacterSetPrimed())
77
collation_iter= all_charsets;
91
bool CollationsTool::Generator::next()
93
while (not nextCollationCore())
96
if (isPrimed() && not end())
99
if (not nextCharacterSet())
108
bool CollationsTool::Generator::populate()
118
void CollationsTool::Generator::fill()
120
const CHARSET_INFO *tmp_cs= character_set();
121
const CHARSET_INFO *tmp_cl= collation_iter[0];
126
assert(tmp_cs->name);
127
/* CHARACTER_SET_NAME */
130
/* "COLLATION_NAME" */
131
assert(tmp_cl->name);
135
push(tmp_cl->csname);
138
push(static_cast<int64_t>(tmp_cl->number));
141
push((bool)(tmp_cl->state & MY_CS_PRIMARY));
144
push((bool)(tmp_cl->state & MY_CS_COMPILED));
147
push(static_cast<int64_t>(tmp_cl->strxfrm_multiply));