22 #include <plugin/schema_dictionary/dictionary.h>
27 IndexesTool::IndexesTool() :
30 add_field(
"TABLE_SCHEMA", plugin::TableFunction::STRING, MAXIMUM_IDENTIFIER_LENGTH,
false);
31 add_field(
"TABLE_NAME", plugin::TableFunction::STRING, MAXIMUM_IDENTIFIER_LENGTH,
false);
32 add_field(
"INDEX_NAME", plugin::TableFunction::STRING, MAXIMUM_IDENTIFIER_LENGTH,
false);
33 add_field(
"IS_USED_IN_PRIMARY", plugin::TableFunction::BOOLEAN, 0,
false);
34 add_field(
"IS_UNIQUE", plugin::TableFunction::BOOLEAN, 0,
false);
35 add_field(
"IS_NULLABLE", plugin::TableFunction::BOOLEAN, 0,
false);
36 add_field(
"KEY_LENGTH", plugin::TableFunction::NUMBER, 0,
false);
37 add_field(
"INDEX_TYPE");
38 add_field(
"INDEX_COMMENT", plugin::TableFunction::STRING, 1024,
true);
41 IndexesTool::Generator::Generator(
Field **arg) :
44 is_index_primed(false)
48 bool IndexesTool::Generator::nextIndexCore()
50 if (isIndexesPrimed())
56 if (not isTablesPrimed())
60 is_index_primed=
true;
63 if (index_iterator >= getTableProto().indexes_size())
66 index= getTableProto().
indexes(index_iterator);
71 bool IndexesTool::Generator::nextIndex()
73 while (not nextIndexCore())
77 is_index_primed=
false;
83 bool IndexesTool::Generator::populate()
93 void IndexesTool::Generator::fill()
96 push(getTableProto().schema());
99 push(getTableProto().name());
105 push(index.is_primary());
108 push(index.is_unique());
111 push(index.options().null_part_key());
114 push(static_cast<uint64_t>(index.key_length()));
117 push(message::type(index.
type()));
120 if (index.has_comment())
122 push(index.comment());
TODO: Rename this file - func.h is stupid.