~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/tableprototester/tableprototester.cc

Merged Drizzle's Trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
117
117
                                                   drizzled::SchemaIdentifier &schema_identifier,
118
118
                                                   drizzled::TableIdentifiers &set_of_identifiers)
119
119
{
120
 
  set_of_identifiers.push_back(TableIdentifier(schema_identifier, "t1"));
 
120
  if (schema_identifier.compare("test"))
 
121
  {
 
122
    set_of_identifiers.push_back(TableIdentifier(schema_identifier, "t1"));
 
123
    set_of_identifiers.push_back(TableIdentifier(schema_identifier, "too_many_enum_values"));
 
124
  }
121
125
}
122
126
 
123
127
bool TableProtoTesterEngine::doDoesTableExist(Session&, TableIdentifier &identifier)
124
128
{
125
129
  if (strcmp(identifier.getPath().c_str(), "./test/t1") == 0)
126
130
    return true;
 
131
  if (strcmp(identifier.getPath().c_str(), "./test/too_many_enum_values") == 0)
 
132
    return true;
127
133
 
128
134
  return false;
129
135
}
175
181
  }
176
182
 
177
183
}
 
184
 
 
185
static void fill_table_too_many_enum_values(message::Table &table)
 
186
{
 
187
  message::Table::Field *field;
 
188
  message::Table::TableOptions *tableopts;
 
189
 
 
190
  table.set_schema("test");
 
191
  table.set_name("too_many_enum_values");
 
192
  table.set_type(message::Table::STANDARD);
 
193
  table.mutable_engine()->set_name("tableprototester");
 
194
  table.set_creation_timestamp(0);
 
195
  table.set_update_timestamp(0);
 
196
  
 
197
 
 
198
  tableopts= table.mutable_options();
 
199
  tableopts->set_comment("Table with too many enum options");
 
200
 
 
201
  {
 
202
    field= table.add_field();
 
203
    field->set_name("many_values");
 
204
    field->set_type(message::Table::Field::ENUM);
 
205
 
 
206
    message::Table::Field::EnumerationValues *field_options= field->mutable_enumeration_values();
 
207
    for(int i=0; i<70000; i++)
 
208
    {
 
209
      char enum_value[100];
 
210
      snprintf(enum_value, sizeof(enum_value), "a%d", i);
 
211
      field_options->add_field_value(enum_value);
 
212
    }
 
213
  }
 
214
 
 
215
}
 
216
 
 
217
 
178
218
int TableProtoTesterEngine::doGetTableDefinition(Session&,
179
219
                                                 drizzled::TableIdentifier &identifier,
180
220
                                                 drizzled::message::Table &table_proto)
184
224
    fill_table1(table_proto);
185
225
    return EEXIST;
186
226
  }
 
227
  else if (strcmp(identifier.getPath().c_str(), "./test/too_many_enum_values")==0)
 
228
  {
 
229
    fill_table_too_many_enum_values(table_proto);
 
230
    return EEXIST;
 
231
  }
187
232
  return ENOENT;
188
233
}
189
234