~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/show_dictionary/show_columns.cc

  • Committer: Olaf van der Spek
  • Date: 2011-08-04 08:13:04 UTC
  • mfrom: (2384 drizzle)
  • mto: This revision was merged to the branch mainline in revision 2385.
  • Revision ID: olafvdspek@gmail.com-20110804081304-rlejjpvoos17bjdf
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
using namespace std;
27
27
using namespace drizzled;
28
28
 
29
 
static const string VARCHAR("VARCHAR");
30
 
/* VARBINARY already defined elsewhere */
31
 
static const string VARBIN("VARBINARY");
32
 
static const string DOUBLE("DOUBLE");
33
 
static const string BLOB("BLOB");
34
 
static const string TEXT("TEXT");
35
 
static const string ENUM("ENUM");
36
 
static const string INTEGER("INTEGER");
37
 
static const string BIGINT("BIGINT");
38
 
static const string DECIMAL("DECIMAL");
39
 
static const string DATE("DATE");
40
 
static const string TIMESTAMP("TIMESTAMP");
41
 
static const string DATETIME("DATETIME");
42
 
 
43
29
ShowColumns::ShowColumns() :
44
30
  show_dictionary::Show("SHOW_COLUMNS")
45
31
{
126
112
  return true;
127
113
}
128
114
 
129
 
void ShowColumns::Generator::pushType(message::Table::Field::FieldType type, const string &collation)
130
 
{
131
 
  switch (type)
132
 
  {
133
 
  default:
134
 
  case message::Table::Field::VARCHAR:
135
 
    push(collation.compare("binary") ? VARCHAR : VARBIN);
136
 
    break;
137
 
  case message::Table::Field::DOUBLE:
138
 
    push(DOUBLE);
139
 
    break;
140
 
  case message::Table::Field::BLOB:
141
 
    push(collation.compare("binary") ? TEXT : BLOB);
142
 
    break;
143
 
  case message::Table::Field::ENUM:
144
 
    push(ENUM);
145
 
    break;
146
 
  case message::Table::Field::INTEGER:
147
 
    push(INTEGER);
148
 
    break;
149
 
  case message::Table::Field::BIGINT:
150
 
    push(BIGINT);
151
 
    break;
152
 
  case message::Table::Field::DECIMAL:
153
 
    push(DECIMAL);
154
 
    break;
155
 
  case message::Table::Field::DATE:
156
 
    push(DATE);
157
 
    break;
158
 
  case message::Table::Field::EPOCH:
159
 
    push(TIMESTAMP);
160
 
    break;
161
 
  case message::Table::Field::DATETIME:
162
 
    push(DATETIME);
163
 
    break;
164
 
  }
165
 
}
166
 
 
167
115
 
168
116
void ShowColumns::Generator::fill()
169
117
{
171
119
  push(column.name());
172
120
 
173
121
  /* Type */
174
 
  pushType(column.type(), column.string_options().collation());
 
122
  push(drizzled::message::type(column));
175
123
 
176
124
  /* Null */
177
125
  push(not column.constraints().is_notnull());