1
1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2010 Sun Microsystems, Inc.
4
* Copyright (C) 2010 Sun Microsystems
6
6
* This program is free software; you can redistribute it and/or modify
7
7
* it under the terms of the GNU General Public License as published by
18
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
#include <plugin/collation_dictionary/dictionary.h>
23
#include "plugin/data_engine/character_sets.h"
24
25
using namespace std;
25
26
using namespace drizzled;
30
31
add_field("CHARACTER_SET_NAME");
31
32
add_field("DEFAULT_COLLATE_NAME");
32
33
add_field("DESCRIPTION");
33
add_field("MAXLEN", plugin::TableFunction::NUMBER, 0, false);
34
add_field("MAXLEN", plugin::TableFunction::NUMBER);
36
37
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)
38
plugin::TableFunction::Generator(arg)
85
43
bool CharacterSetsTool::Generator::populate()
87
if (nextCharacterSet())
45
for (; cs < all_charsets+255 ; cs++)
47
const CHARSET_INFO * const tmp_cs= cs[0];
49
if (tmp_cs && (tmp_cs->state & MY_CS_PRIMARY) &&
50
(tmp_cs->state & MY_CS_AVAILABLE) &&
51
! (tmp_cs->state & MY_CS_HIDDEN))
53
/* CHARACTER_SET_NAME */
56
/* DEFAULT_COLLATE_NAME */
60
push(tmp_cs->comment);
63
push((int64_t) tmp_cs->mbmaxlen);
96
void CharacterSetsTool::Generator::fill()
98
const charset_info_st * 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));