~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/alter_table.cc

  • Committer: Olaf van der Spek
  • Date: 2011-08-19 08:06:53 UTC
  • mto: This revision was merged to the branch mainline in revision 2408.
  • Revision ID: olafvdspek@gmail.com-20110819080653-kvxd8zva88i9s3p1
Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
536
536
    if (key_parts.size())
537
537
    {
538
538
      key_create_information_st key_create_info= default_key_create_info;
539
 
      Key *key;
540
 
      Key::Keytype key_type;
541
 
 
542
539
      key_create_info.algorithm= key_info->algorithm;
543
540
 
544
541
      if (key_info->flags & HA_USES_BLOCK_SIZE)
547
544
      if (key_info->flags & HA_USES_COMMENT)
548
545
        key_create_info.comment= key_info->comment;
549
546
 
 
547
      Key::Keytype key_type;
550
548
      if (key_info->flags & HA_NOSAME)
551
549
      {
552
 
        if (is_primary_key_name(key_name))
553
 
          key_type= Key::PRIMARY;
554
 
        else
555
 
          key_type= Key::UNIQUE;
 
550
        key_type= is_primary_key(key_name) ? Key::PRIMARY : Key::UNIQUE;
556
551
      }
557
552
      else
558
553
      {
559
554
        key_type= Key::MULTIPLE;
560
555
      }
561
 
 
562
 
      key= new Key(key_type,
563
 
                   key_name,
564
 
                   strlen(key_name),
565
 
                   &key_create_info,
566
 
                   test(key_info->flags & HA_GENERATED_KEY),
567
 
                   key_parts);
568
 
      new_key_list.push_back(key);
 
556
      new_key_list.push_back(new Key(key_type, key_name, strlen(key_name), &key_create_info, test(key_info->flags & HA_GENERATED_KEY), key_parts));
569
557
    }
570
558
  }
571
559
 
618
606
      if (key->type != Key::FOREIGN_KEY)
619
607
        new_key_list.push_back(key);
620
608
 
621
 
      if (key->name.str && is_primary_key_name(key->name.str))
 
609
      if (key->name.str && is_primary_key(key->name.str))
622
610
      {
623
 
        my_error(ER_WRONG_NAME_FOR_INDEX,
624
 
                 MYF(0),
625
 
                 key->name.str);
 
611
        my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key->name.str);
626
612
        return true;
627
613
      }
628
614
    }