~vjsamuel/drizzle/fix-bug-850858

« back to all changes in this revision

Viewing changes to drizzled/statement/alter_table.cc

  • Committer: Mark Atwood
  • Date: 2011-08-21 06:56:57 UTC
  • mfrom: (2385.3.34 rf)
  • Revision ID: me@mark.atwood.name-20110821065657-vk2at03z9u17mf1d
mergeĀ lp:~olafvdspek/drizzle/refactor7

Show diffs side-by-side

added added

removed removed

Lines of Context:
316
316
  {
317
317
    /* Check if field should be dropped */
318
318
    vector<string>::iterator it= drop_columns.begin();
319
 
    while ((it != drop_columns.end()))
 
319
    while (it != drop_columns.end())
320
320
    {
321
 
      if (! my_strcasecmp(system_charset_info, field->field_name, (*it).c_str()))
 
321
      if (not my_strcasecmp(system_charset_info, field->field_name, it->c_str()))
322
322
      {
323
323
        /* Reset auto_increment value if it was dropped */
324
324
        if (MTYP_TYPENR(field->unireg_check) == Field::NEXT_NUMBER &&
469
469
    char *key_name= key_info->name;
470
470
 
471
471
    vector<string>::iterator it= drop_keys.begin();
472
 
    while ((it != drop_keys.end()))
 
472
    while (it != drop_keys.end())
473
473
    {
474
 
      if (! my_strcasecmp(system_charset_info, key_name, (*it).c_str()))
 
474
      if (not my_strcasecmp(system_charset_info, key_name, (*it).c_str()))
475
475
        break;
476
476
      it++;
477
477
    }
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
 
573
561
  for (int32_t j= 0; j < original_proto.fk_constraint_size(); j++)
574
562
  {
575
563
    vector<string>::iterator it= drop_fkeys.begin();
576
 
    while ((it != drop_fkeys.end()))
 
564
    while (it != drop_fkeys.end())
577
565
    {
578
 
      if (! my_strcasecmp(system_charset_info, original_proto.fk_constraint(j).name().c_str(), (*it).c_str()))
 
566
      if (! my_strcasecmp(system_charset_info, original_proto.fk_constraint(j).name().c_str(), it->c_str()))
579
567
      {
580
568
        break;
581
569
      }
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
    }