1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2010 Sun Microsystems
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
#include "plugin/collation_dictionary/dictionary.h"
25
using namespace drizzled;
27
CharacterSetsTool::CharacterSetsTool() :
28
plugin::TableFunction("DATA_DICTIONARY", "CHARACTER_SETS")
30
add_field("CHARACTER_SET_NAME");
31
add_field("DEFAULT_COLLATE_NAME");
32
add_field("DESCRIPTION");
33
add_field("MAXLEN", plugin::TableFunction::NUMBER);
36
CharacterSetsTool::Generator::Generator(Field **arg) :
37
plugin::TableFunction::Generator(arg),
42
bool CharacterSetsTool::Generator::checkCharacterSet()
44
if (character_set() && (character_set()->state & MY_CS_PRIMARY) &&
45
(character_set()->state & MY_CS_AVAILABLE) && not (character_set()->state & MY_CS_HIDDEN))
53
bool CharacterSetsTool::Generator::nextCharacterSetCore()
61
character_set_iter= all_charsets;
65
if (character_set_iter == all_charsets+255)
68
if (checkCharacterSet())
74
bool CharacterSetsTool::Generator::nextCharacterSet()
76
while (not nextCharacterSetCore())
78
if (character_set_iter == all_charsets+255)
85
bool CharacterSetsTool::Generator::populate()
87
if (nextCharacterSet())
96
void CharacterSetsTool::Generator::fill()
98
const CHARSET_INFO * const tmp_cs= character_set_iter[0];
100
/* CHARACTER_SET_NAME */
101
push(tmp_cs->csname);
103
/* DEFAULT_COLLATE_NAME */
107
push(tmp_cs->comment);
110
push(static_cast<int64_t>(tmp_cs->mbmaxlen));