267
267
int2store(fileinfo+28,key_info_length);
270
int2store(fileinfo+59,db_file->extra_rec_buf_length());
270
int2store(fileinfo+59, 0); /* was: extra_rec_buf_length */
272
272
if (pwrite(file, fileinfo, 64, 0L) == 0 ||
273
273
pwrite(file, keybuff, key_info_length, (ulong) uint2korr(fileinfo+6)) == 0)
480
481
attribute->set_type(drizzle::Table::Field::BLOB);
487
if(field_arg->vcol_info)
489
drizzle::Table::Field::VirtualFieldOptions *field_options;
491
field_options= attribute->mutable_virtual_options();
493
field_options->set_type(attribute->type());
494
attribute->set_type(drizzle::Table::Field::VIRTUAL);
496
field_options->set_expression(field_arg->vcol_info->expr_str.str);
497
field_options->set_physically_stored(field_arg->is_stored);
488
502
constraints->set_is_nullable(field_arg->def->null_value);
491
/* Set the comment */
505
switch(field_arg->column_format())
507
case COLUMN_FORMAT_TYPE_NOT_USED:
509
case COLUMN_FORMAT_TYPE_DEFAULT:
510
attribute->set_format(drizzle::Table::Field::DefaultFormat);
512
case COLUMN_FORMAT_TYPE_FIXED:
513
attribute->set_format(drizzle::Table::Field::FixedFormat);
515
case COLUMN_FORMAT_TYPE_DYNAMIC:
516
attribute->set_format(drizzle::Table::Field::DynamicFormat);
492
522
if (field_arg->comment.length)
493
523
attribute->set_comment(field_arg->comment.str);
525
if(field_arg->unireg_check == Field::NEXT_NUMBER)
527
drizzle::Table::Field::NumericFieldOptions *field_options;
528
field_options= attribute->mutable_numeric_options();
529
field_options->set_is_autoincrement(true);
532
if(field_arg->unireg_check == Field::TIMESTAMP_DN_FIELD
533
|| field_arg->unireg_check == Field::TIMESTAMP_DNUN_FIELD)
535
drizzle::Table::Field::FieldOptions *field_options;
536
field_options= attribute->mutable_options();
537
field_options->set_default_value("NOW()");
540
if(field_arg->unireg_check == Field::TIMESTAMP_UN_FIELD
541
|| field_arg->unireg_check == Field::TIMESTAMP_DNUN_FIELD)
543
drizzle::Table::Field::FieldOptions *field_options;
544
field_options= attribute->mutable_options();
545
field_options->set_update_value("NOW()");
548
assert(field_arg->unireg_check == Field::NONE
549
|| field_arg->unireg_check == Field::NEXT_NUMBER
550
|| field_arg->unireg_check == Field::TIMESTAMP_DN_FIELD
551
|| field_arg->unireg_check == Field::TIMESTAMP_UN_FIELD
552
|| field_arg->unireg_check == Field::TIMESTAMP_DNUN_FIELD);
554
/* Fuck me. seriously, wtf */
555
ulong data_offset= (create_info->null_bits + 7)/8;
556
attribute->set_recpos(field_arg->offset+1 + (uint)data_offset);
559
- flag should never mean flag
560
- unireg_check/unireg_type should exist
561
- and field length should be specified for fixed sized types.
565
These should all die a horrible death. A freeze-ray is too good for them.
566
A death-ray is way better.
568
attribute->set_pack_flag(field_arg->pack_flag);
569
attribute->set_field_length(field_arg->length);
570
attribute->set_interval_nr(field_arg->interval_id);
496
573
if (create_info->used_fields & HA_CREATE_USED_PACK_KEYS)
872
949
pos[length + 3]= '\0';
873
950
pos+= length + 3 + 1;
875
cfield->row=(uint8_t) row;
876
cfield->col=(uint8_t) (length+1);
877
cfield->sc_length=(uint8_t) cmin(cfield->length,(uint32_t)cols-(length+2));
879
953
length=(uint) (pos-start_screen);
880
954
int2store(start_screen,length);
972
1046
uint32_t info_length, uint32_t screens, uint32_t table_options,
973
1047
ulong data_offset, handler *file)
975
uint32_t length,int_count,int_length,no_empty, int_parts;
1049
uint32_t length,int_count,int_length, int_parts;
976
1050
uint32_t time_stamp_pos,null_fields;
977
1051
ulong reclength, totlength, n_length, com_length, vcol_info_length;
1033
1107
totlength+= field->length;
1034
1108
com_length+= field->comment.length;
1035
if (MTYP_TYPENR(field->unireg_check) == Field::NOEMPTY ||
1036
field->unireg_check & MTYP_NOEMPTY_BIT)
1038
field->unireg_check= (Field::utype) ((uint) field->unireg_check |
1043
1110
We mark first TIMESTAMP field with NOW() in DEFAULT or ON UPDATE
1044
1111
as auto-update field.
1129
1196
int2store(forminfo+258,create_fields.elements);
1130
1197
int2store(forminfo+260,info_length);
1131
1198
int2store(forminfo+262,totlength);
1132
int2store(forminfo+264,no_empty);
1199
int2store(forminfo+264,0); // no_empty
1133
1200
int2store(forminfo+266,reclength);
1134
1201
int2store(forminfo+268,n_length);
1135
1202
int2store(forminfo+270,int_count);
1195
1262
uint32_t recpos;
1196
1263
uint32_t cur_vcol_expr_len= 0;
1197
buff[0]= (unsigned char) field->row;
1198
buff[1]= (unsigned char) field->col;
1199
buff[2]= (unsigned char) field->sc_length;
1264
buff[0]= 0; //(unsigned char) field->row;
1265
buff[1]= 0; //(unsigned char) field->col;
1266
buff[2]= 0; //(unsigned char) field->sc_length;
1200
1267
int2store(buff+3, field->length);
1201
1268
/* The +1 is here becasue the col offset in .frm file have offset 1 */
1202
1269
recpos= field->offset+1 + (uint) data_offset;
1448
1515
regfield->set_notnull();
1449
1516
regfield->store((int64_t) 1, true);
1451
else if (type == Field::YES) // Old unireg type
1452
regfield->store(ER(ER_YES),(uint) strlen(ER(ER_YES)),system_charset_info);
1453
else if (type == Field::NO) // Old unireg type
1454
regfield->store(ER(ER_NO), (uint) strlen(ER(ER_NO)),system_charset_info);
1456
1519
regfield->reset();