~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/unireg.cc

Read Fields out of proto instead of FRM.

As non-radioactive fallout:
- no implicit defaults (see http://bugs.mysql.com/bug.php?id=43151)
- no real defaults for BLOB yet... but this paves the way (and it shouldn't be too hard now)

As radioactive fallout:
- parse_table_proto is approaching the length of War and Peace
- handling of corrupted proto is about non-existant. abort() is not ideal

Show diffs side-by-side

added added

removed removed

Lines of Context:
484
484
          set_field_options->add_field_value(src);
485
485
        }
486
486
        set_field_options->set_count_elements(set_field_options->field_value_size());
 
487
        set_field_options->set_collation_id(field_arg->charset->number);
 
488
        set_field_options->set_collation(field_arg->charset->name);
487
489
        break;
488
490
      }
489
491
    case DRIZZLE_TYPE_BLOB:
490
 
      attribute->set_type(drizzle::Table::Field::BLOB);
 
492
      {
 
493
        attribute->set_type(drizzle::Table::Field::BLOB);
 
494
 
 
495
        drizzle::Table::Field::StringFieldOptions *string_field_options;
 
496
 
 
497
        string_field_options= attribute->mutable_string_options();
 
498
        string_field_options->set_collation_id(field_arg->charset->number);
 
499
        string_field_options->set_collation(field_arg->charset->name);
 
500
      }
 
501
 
491
502
      break;
492
503
    default:
493
504
      abort();
568
579
        String d;
569
580
        String *default_value= field_arg->def->val_str(&d);
570
581
 
571
 
        if(field_arg->sql_type==DRIZZLE_TYPE_VARCHAR
572
 
           && field_arg->charset==&my_charset_bin)
 
582
        if((field_arg->sql_type==DRIZZLE_TYPE_VARCHAR
 
583
            && field_arg->charset==&my_charset_bin)
 
584
           || (field_arg->sql_type==DRIZZLE_TYPE_BLOB
 
585
            && field_arg->charset==&my_charset_bin))
573
586
        {
574
587
          string bin_default;
575
588
          bin_default.assign(default_value->c_ptr(),
1502
1515
    /*
1503
1516
      regfield don't have to be deleted as it's allocated with sql_alloc()
1504
1517
    */
1505
 
    Field *regfield= make_field(&share,
 
1518
    Field *regfield= make_field(&share, NULL,
1506
1519
                                buff+field->offset + data_offset,
1507
1520
                                field->length,
1508
1521
                                null_pos + null_count / 8,