~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/unireg.cc

  • Committer: Brian Aker
  • Date: 2009-02-09 20:00:19 UTC
  • mfrom: (859.1.1 nofrm)
  • Revision ID: brian@tangent.org-20090209200019-fhik9eshxp0q08ii
Merge Stewart.

Show diffs side-by-side

added added

removed removed

Lines of Context:
592
592
 
593
593
    idx->set_name(key_info[i].name);
594
594
 
 
595
    idx->set_key_length(key_info[i].key_length);
 
596
 
595
597
    if(is_primary_key_name(key_info[i].name))
596
598
      idx->set_is_primary(true);
597
599
    else
608
610
      break;
609
611
 
610
612
    case HA_KEY_ALG_RTREE:
 
613
      idx->set_type(drizzle::Table::Index::RTREE);
611
614
    case HA_KEY_ALG_FULLTEXT:
 
615
      idx->set_type(drizzle::Table::Index::FULLTEXT);
612
616
    case HA_KEY_ALG_UNDEF:
613
617
      idx->set_type(drizzle::Table::Index::UNKNOWN_INDEX);
614
618
      break;
622
626
    else
623
627
      idx->set_is_unique(false);
624
628
 
625
 
    /* FIXME: block_size ? */
 
629
    drizzle::Table::Index::IndexOptions *index_options= idx->mutable_options();
 
630
 
 
631
    if(key_info[i].flags & HA_USES_BLOCK_SIZE)
 
632
      index_options->set_key_block_size(key_info[i].block_size);
 
633
 
 
634
    if(key_info[i].flags & HA_PACK_KEY)
 
635
      index_options->set_pack_key(true);
 
636
 
 
637
    if(key_info[i].flags & HA_BINARY_PACK_KEY)
 
638
      index_options->set_binary_pack_key(true);
 
639
 
 
640
    if(key_info[i].flags & HA_VAR_LENGTH_PART)
 
641
      index_options->set_var_length_key(true);
 
642
 
 
643
    if(key_info[i].flags & HA_NULL_PART_KEY)
 
644
      index_options->set_null_part_key(true);
 
645
 
 
646
    if(key_info[i].flags & HA_KEY_HAS_PART_KEY_SEG)
 
647
      index_options->set_has_partial_segments(true);
 
648
 
 
649
    if(key_info[i].flags & HA_GENERATED_KEY)
 
650
      index_options->set_auto_generated_key(true);
 
651
 
 
652
    if (key_info[i].flags & HA_USES_COMMENT)
 
653
      idx->set_comment(key_info[i].comment.str);
 
654
 
 
655
    if(key_info[i].flags & ~(HA_NOSAME | HA_PACK_KEY | HA_USES_BLOCK_SIZE | HA_BINARY_PACK_KEY | HA_VAR_LENGTH_PART | HA_NULL_PART_KEY | HA_KEY_HAS_PART_KEY_SEG | HA_GENERATED_KEY | HA_USES_COMMENT))
 
656
      abort(); // Invalid (unknown) index flag.
626
657
 
627
658
    for(unsigned int j=0; j< key_info[i].key_parts; j++)
628
659
    {
629
660
      drizzle::Table::Index::IndexPart *idxpart;
630
 
      drizzle::Table::Field *field;
631
661
 
632
662
      idxpart= idx->add_index_part();
633
663
 
634
 
      field= idxpart->mutable_field();
635
 
      *field= table_proto->field(key_info[i].key_part[j].fieldnr);
 
664
      idxpart->set_fieldnr(key_info[i].key_part[j].fieldnr+1);
636
665
 
637
666
      idxpart->set_compare_length(key_info[i].key_part[j].length);
638
667
    }
639
 
 
640
 
    if (key_info[i].flags & HA_USES_COMMENT)
641
 
      idx->set_comment(key_info[i].comment.str);
642
668
  }
643
669
}
644
670