~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/show_dictionary/show_columns.cc

  • Committer: lbieber
  • Date: 2010-10-01 13:06:31 UTC
  • mfrom: (1802.2.2 drizzle-bug-651948)
  • mto: This revision was merged to the branch mainline in revision 1805.
  • Revision ID: lbieber@orisndriz08-20101001130631-xubscnhmj7r5dn6g
Merge Andrew - Fix bug 651948 - Index lengths not retrieved using drizzledump

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
static const string DATETIME("DATETIME");
42
42
 
43
43
ShowColumns::ShowColumns() :
44
 
  show_dictionary::Show("SHOW_COLUMNS")
 
44
  plugin::TableFunction("DATA_DICTIONARY", "SHOW_COLUMNS")
45
45
{
46
46
  add_field("Field");
47
47
  add_field("Type");
52
52
}
53
53
 
54
54
ShowColumns::Generator::Generator(Field **arg) :
55
 
  show_dictionary::Show::Generator(arg),
 
55
  plugin::TableFunction::Generator(arg),
56
56
  is_tables_primed(false),
57
57
  is_columns_primed(false),
58
58
  column_iterator(0)
59
59
{
60
 
  if (not isShowQuery())
61
 
   return;
62
 
 
63
 
  statement::Show *select= static_cast<statement::Show *>(getSession().lex->statement);
 
60
  statement::Select *select= static_cast<statement::Select *>(getSession().lex->statement);
64
61
 
65
62
  if (not select->getShowTable().empty() && not select->getShowSchema().empty())
66
63
  {
67
64
    table_name.append(select->getShowTable().c_str());
68
 
    identifier::Table identifier(select->getShowSchema().c_str(), select->getShowTable().c_str());
 
65
    TableIdentifier identifier(select->getShowSchema().c_str(), select->getShowTable().c_str());
69
66
 
70
67
    is_tables_primed= plugin::StorageEngine::getTableDefinition(getSession(),
71
68
                                                                identifier,
88
85
    is_columns_primed= true;
89
86
  }
90
87
 
91
 
  if (column_iterator >= getTableProto()->field_size())
 
88
  if (column_iterator >= getTableProto().field_size())
92
89
    return false;
93
90
 
94
 
  column= getTableProto()->field(column_iterator);
 
91
  column= getTableProto().field(column_iterator);
95
92
 
96
93
  return true;
97
94
}
147
144
  case message::Table::Field::DATE:
148
145
    push(DATE);
149
146
    break;
150
 
  case message::Table::Field::EPOCH:
 
147
  case message::Table::Field::TIMESTAMP:
151
148
    push(TIMESTAMP);
152
149
    break;
153
150
  case message::Table::Field::DATETIME:
166
163
  pushType(column.type(), column.string_options().collation());
167
164
 
168
165
  /* Null */
169
 
  push(not column.constraints().is_notnull());
 
166
  push(column.constraints().is_nullable());
170
167
 
171
168
  /* Default */
172
169
  if (column.options().has_default_value())