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;
28
CollationsTool::CollationsTool() :
29
plugin::TableFunction("DATA_DICTIONARY", "COLLATIONS")
31
add_field("CHARACTER_SET_NAME");
32
add_field("COLLATION_NAME");
33
add_field("DESCRIPTION");
34
add_field("ID", plugin::TableFunction::NUMBER);
35
add_field("IS_DEFAULT", plugin::TableFunction::BOOLEAN);
36
add_field("IS_COMPILED", plugin::TableFunction::BOOLEAN);
37
add_field("SORTLEN", plugin::TableFunction::NUMBER);
40
CollationsTool::Generator::Generator(Field **arg) :
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);