~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/schema_dictionary/tables.cc

  • Committer: Mark Atwood
  • Date: 2011-10-27 05:08:12 UTC
  • mfrom: (2445.1.11 rf)
  • Revision ID: me@mark.atwood.name-20111027050812-1icvs72lb0u4xdc4
mergeĀ lp:~olafvdspek/drizzle/refactor8

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#include "config.h"
22
 
#include "plugin/schema_dictionary/dictionary.h"
23
 
#include "drizzled/identifier.h"
 
21
#include <config.h>
 
22
#include <plugin/schema_dictionary/dictionary.h>
 
23
#include <drizzled/identifier.h>
 
24
#include <drizzled/table_proto.h>
24
25
 
25
26
using namespace std;
26
27
using namespace drizzled;
45
46
TablesTool::TablesTool() :
46
47
  plugin::TableFunction("DATA_DICTIONARY", "TABLES")
47
48
{
48
 
  add_field("TABLE_SCHEMA");
49
 
  add_field("TABLE_NAME");
 
49
  add_field("TABLE_SCHEMA", plugin::TableFunction::STRING, MAXIMUM_IDENTIFIER_LENGTH, false);
 
50
  add_field("TABLE_NAME", plugin::TableFunction::STRING, MAXIMUM_IDENTIFIER_LENGTH, false);
50
51
  add_field("TABLE_TYPE");
51
52
  add_field("TABLE_ARCHETYPE");
52
53
  add_field("ENGINE");
54
55
  add_field("TABLE_COLLATION");
55
56
  add_field("TABLE_CREATION_TIME");
56
57
  add_field("TABLE_UPDATE_TIME");
57
 
  add_field("TABLE_COMMENT", plugin::TableFunction::STRING, 2048, true);
 
58
  add_field("TABLE_COMMENT", plugin::TableFunction::STRING,
 
59
            TABLE_COMMENT_MAXLEN, true);
58
60
  add_field("AUTO_INCREMENT", plugin::TableFunction::NUMBER, 0, false);
59
61
  add_field("TABLE_UUID", plugin::TableFunction::STRING, 36, true);
60
62
  add_field("TABLE_VERSION", plugin::TableFunction::NUMBER, 0, true);
 
63
  add_field("IS_REPLICATED", plugin::TableFunction::BOOLEAN, 0, false);
 
64
  add_field("TABLE_DEFINER", plugin::TableFunction::STRING, 64, true);
61
65
}
62
66
 
63
67
TablesTool::Generator::Generator(Field **arg) :
103
107
  push(getTableMessage().name());
104
108
 
105
109
  /* TABLE_TYPE */
106
 
  if (drizzled::TableIdentifier::isView(getTableMessage().type()))
 
110
  if (drizzled::identifier::Table::isView(getTableMessage().type()))
107
111
  {
108
112
    push("VIEW");
109
113
  }
133
137
  }
134
138
 
135
139
  /* ENGINE */
136
 
  push(getTableMessage().engine().name());
 
140
  const drizzled::message::Engine &engine= getTableMessage().engine();
 
141
  push(engine.name());
137
142
 
138
143
  /* ROW_FORMAT */
139
 
  push("DEFAULT");
 
144
  bool row_format_sent= false;
 
145
  for (ssize_t it= 0; it < engine.options_size(); it++)
 
146
  {
 
147
    const drizzled::message::Engine::Option &opt= engine.options(it);
 
148
    if (opt.name().compare("ROW_FORMAT") == 0)
 
149
    {
 
150
      row_format_sent= true;
 
151
      push(opt.state());
 
152
      break;
 
153
    }
 
154
  }
 
155
 
 
156
  if (not row_format_sent)
 
157
    push("DEFAULT");
140
158
 
141
159
  /* TABLE_COLLATION */
142
160
  push(getTableMessage().options().collation());
174
192
 
175
193
  /* TABLE_VERSION */
176
194
  push(getTableMessage().version());
 
195
 
 
196
  /* IS_REPLICATED */
 
197
  push(message::is_replicated(getTableMessage()));
 
198
 
 
199
  /* _DEFINER */
 
200
  if (message::has_definer(getTableMessage()))
 
201
  {
 
202
    push(message::definer(getTableMessage()));
 
203
  }
 
204
  else
 
205
  {
 
206
    push();
 
207
  }
177
208
}