91
int mysql_frm_type(char *path, enum legacy_db_type *dbt)
92
int drizzle_read_table_proto(const char* path, drizzle::Table* table)
94
unsigned char header[10];
97
*dbt= DB_TYPE_UNKNOWN;
99
file= open(path, O_RDONLY);
104
error= read(file, header, sizeof(header));
107
if (error!=sizeof(header))
111
This is just a check for DB_TYPE. We'll return default unknown type
112
if the following test is true (arg #3). This should not have effect
113
on return value from this function (default FRMTYPE_TABLE)
115
if (header[0] != (unsigned char)254 || header[1] != 1 ||
116
(header[2] != FRM_VER && header[2] != FRM_VER+1 &&
117
(header[2] < FRM_VER+3 || header[2] > FRM_VER+4)))
120
*dbt= (enum legacy_db_type) (uint) *(header + 3);
95
fstream input(path, ios::in | ios::binary);
96
if (!table->ParseFromIstream(&input))
482
462
const char *src= field_arg->interval->type_names[pos];
484
set_field_options->add_value(src);
464
set_field_options->add_field_value(src);
486
set_field_options->set_count_elements(set_field_options->value_size());
466
set_field_options->set_count_elements(set_field_options->field_value_size());
489
469
case DRIZZLE_TYPE_BLOB:
503
483
attribute->set_comment(field_arg->comment.str);
486
if (create_info->used_fields & HA_CREATE_USED_PACK_KEYS)
488
if(create_info->table_options & HA_OPTION_PACK_KEYS)
489
table_options->set_pack_keys(true);
490
else if(create_info->table_options & HA_OPTION_NO_PACK_KEYS)
491
table_options->set_pack_keys(false);
494
if (create_info->used_fields & HA_CREATE_USED_CHECKSUM)
496
assert(create_info->table_options & (HA_OPTION_CHECKSUM | HA_OPTION_NO_CHECKSUM));
498
if(create_info->table_options & HA_OPTION_CHECKSUM)
499
table_options->set_checksum(true);
501
table_options->set_checksum(false);
504
if (create_info->used_fields & HA_CREATE_USED_PAGE_CHECKSUM)
506
if (create_info->page_checksum == HA_CHOICE_YES)
507
table_options->set_page_checksum(true);
508
else if (create_info->page_checksum == HA_CHOICE_NO)
509
table_options->set_page_checksum(false);
512
if (create_info->used_fields & HA_CREATE_USED_DELAY_KEY_WRITE)
514
if(create_info->table_options & HA_OPTION_DELAY_KEY_WRITE)
515
table_options->set_delay_key_write(true);
516
else if(create_info->table_options & HA_OPTION_NO_DELAY_KEY_WRITE)
517
table_options->set_delay_key_write(false);
520
switch(create_info->row_type)
522
case ROW_TYPE_DEFAULT:
523
table_options->set_row_type(drizzle::Table::TableOptions::ROW_TYPE_DEFAULT);
526
table_options->set_row_type(drizzle::Table::TableOptions::ROW_TYPE_FIXED);
528
case ROW_TYPE_DYNAMIC:
529
table_options->set_row_type(drizzle::Table::TableOptions::ROW_TYPE_DYNAMIC);
531
case ROW_TYPE_COMPRESSED:
532
table_options->set_row_type(drizzle::Table::TableOptions::ROW_TYPE_COMPRESSED);
534
case ROW_TYPE_REDUNDANT:
535
table_options->set_row_type(drizzle::Table::TableOptions::ROW_TYPE_REDUNDANT);
537
case ROW_TYPE_COMPACT:
538
table_options->set_row_type(drizzle::Table::TableOptions::ROW_TYPE_COMPACT);
541
table_options->set_row_type(drizzle::Table::TableOptions::ROW_TYPE_PAGE);
506
547
if (create_info->comment.length)
507
548
table_options->set_comment(create_info->comment.str);
509
if (create_info->table_charset)
550
if (create_info->default_table_charset)
511
table_options->set_collation_id(field_arg->charset->number);
512
table_options->set_collation(field_arg->charset->name);
552
table_options->set_collation_id(
553
create_info->default_table_charset->number);
554
table_options->set_collation(create_info->default_table_charset->name);
515
557
if (create_info->connect_string.length)
613
655
return my_rename(from_path.c_str(),to_path.c_str(),MYF(MY_WME));
616
int delete_table_proto_file(char *file_name)
658
int delete_table_proto_file(const char *file_name)
618
660
string new_path(file_name);
619
661
string file_ext = ".dfe";
724
766
file->ha_create_handler_files(path, NULL, CHF_DELETE_FLAG, create_info);
725
767
my_delete(frm_name, MYF(0));
726
delete_table_proto_file(frm_name);
769
delete_table_proto_file(path);
729
772
} /* rea_create_table */