78
79
index->set_is_primary(is_primary);
79
80
index->set_is_unique(is_unique);
84
for(int i=0; i< num_index_parts; i++)
85
key_length+= compare_lengths[i];
87
index->set_key_length(key_length);
81
89
while (x < num_index_parts)
83
91
index_part= index->add_index_part();
201
static void fill_table1(message::Table *table)
203
message::Table::Field *field;
204
message::Table::TableOptions *tableopts;
206
table->set_name("t1");
207
table->set_type(message::Table::INTERNAL);
209
tableopts= table->mutable_options();
210
tableopts->set_comment("Table without a StorageEngine message");
213
field= table->add_field();
214
field->set_name("number");
215
field->set_type(message::Table::Field::INTEGER);
220
static void usage(char *argv0)
222
cerr << "Usage: " << argv0 << " [-t N] TABLE_NAME.dfe" << endl;
224
cerr << "-t N\tTable Number" << endl;
225
cerr << "\t0 - default" << endl;
193
229
int main(int argc, char* argv[])
195
234
GOOGLE_PROTOBUF_VERIFY_VERSION;
236
while ((opt= getopt(argc, argv, "t:")) != -1)
199
cerr << "Usage: " << argv[0] << " SCHEMA" << endl;
241
table_number= atoi(optarg);
249
if (optind >= argc) {
250
fprintf(stderr, "Expected Table name argument\n\n");
203
255
message::Table table;
205
fill_table(&table, "example_table");
257
switch (table_number)
260
fill_table(&table, "example_table");
266
fprintf(stderr, "Invalid table number.\n\n");
207
fstream output(argv[1], ios::out | ios::trunc | ios::binary);
271
fstream output(argv[optind], ios::out | ios::trunc | ios::binary);
208
272
if (!table.SerializeToOstream(&output))
210
274
cerr << "Failed to write schema." << endl;