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
21
#include <plugin/data_engine/dictionary.h>
24
using namespace drizzled;
26
SchemaTool::SchemaTool() :
29
add_field("SCHEMA_NAME", message::Table::Field::VARCHAR, 64);
32
SchemaTool::Generator::Generator()
34
plugin::StorageEngine::getSchemaNames(set_of_names);
36
it= set_of_names.begin();
39
bool SchemaTool::Generator::populate(Field ** fields)
41
const CHARSET_INFO * const scs= system_charset_info;
42
Field **field= fields;
44
if (it == set_of_names.end())
47
(*field)->store((*it).c_str(), (*it).length(), scs);
54
SchemaFullTool::SchemaFullTool() :
57
add_field("SCHEMA_NAME", message::Table::Field::VARCHAR, 64);
58
add_field("DEFAULT_COLLATION_NAME", message::Table::Field::VARCHAR, 64);
61
SchemaFullTool::Generator::Generator()
63
plugin::StorageEngine::getSchemaNames(set_of_names);
65
it= set_of_names.begin();
68
bool SchemaFullTool::Generator::populate(Field ** fields)
70
message::Schema schema;
71
const CHARSET_INFO * const scs= system_charset_info;
72
Field **field= fields;
75
if (it == set_of_names.end())
78
string schema_name= (*it);
79
error= plugin::StorageEngine::getSchemaDefinition(schema_name, schema);
83
(*field)->store((*it).c_str(), (*it).length(), scs);
86
(*field)->store("<error>", sizeof("<error>"), scs);
90
(*field)->store(schema.name().c_str(), schema.name().length(), scs);
93
(*field)->store(schema.collation().c_str(), schema.collation().length(), scs);