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/schemas.h"
23
extern size_t build_table_filename(char *buff, size_t bufflen, const char *db, const char *table_name, bool is_tmp);
26
using namespace drizzled;
28
TablesTool::TablesTool() :
31
add_field("TABLE_SCHEMA");
32
add_field("TABLE_NAME");
33
add_field("TABLE_TYPE");
35
add_field("ROW_FORMAT", 10);
36
add_field("TABLE_COLLATION");
37
add_field("TABLE_COMMENT", 2048);
40
TablesTool::Generator::Generator(Field **arg) :
41
SchemasTool::Generator(arg),
42
is_tables_primed(false)
46
bool TablesTool::Generator::nextTableCore()
54
if (not isSchemaPrimed())
58
plugin::StorageEngine::getTableNames(schema_name(), table_names);
59
table_iterator= table_names.begin();
60
is_tables_primed= true;
63
if (table_iterator == table_names.end())
68
Session *session= current_session;
70
build_table_filename(path, sizeof(path), schema_name().c_str(), table_name().c_str(), false);
71
plugin::StorageEngine::getTableDefinition(*session,
73
schema_name().c_str(),
82
bool TablesTool::Generator::nextTable()
84
while (not nextTableCore())
88
is_tables_primed= false;
94
bool TablesTool::Generator::populate()
104
void TablesTool::Generator::fill()
117
switch (table_proto.type())
120
case message::Table::STANDARD:
123
case message::Table::TEMPORARY:
126
case message::Table::INTERNAL:
129
case message::Table::FUNCTION:
137
push(table_proto.engine().name());
143
switch (table_proto.options().row_type())
146
case message::Table::TableOptions::ROW_TYPE_DEFAULT:
149
case message::Table::TableOptions::ROW_TYPE_FIXED:
152
case message::Table::TableOptions::ROW_TYPE_DYNAMIC:
155
case message::Table::TableOptions::ROW_TYPE_COMPRESSED:
158
case message::Table::TableOptions::ROW_TYPE_REDUNDANT:
161
case message::Table::TableOptions::ROW_TYPE_COMPACT:
164
case message::Table::TableOptions::ROW_TYPE_PAGE:
168
message::Table::TableOptions options= table_proto.options();
173
/* TABLE_COLLATION */
174
push(table_proto.options().collation());
177
push(table_proto.options().comment());