~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/heap/ha_heap.cc

  • Committer: lbieber
  • Date: 2010-09-10 05:19:01 UTC
  • mfrom: (1753.1.1 build)
  • Revision ID: lbieber@orisndriz03-20100910051901-lyq4bh4vdegvzyo4
Merge Brian - clean up Heap code

Show diffs side-by-side

added added

removed removed

Lines of Context:
277
277
 
278
278
void ha_heap::set_keys_for_scanning(void)
279
279
{
280
 
  btree_keys.reset();
281
280
}
282
281
 
283
282
 
687
686
  uint32_t auto_key= 0, auto_key_type= 0;
688
687
  uint32_t max_key_fieldnr = 0, key_part_size = 0, next_field_pos = 0;
689
688
  uint32_t column_count= table_arg->getShare()->sizeFields();
690
 
  std::vector<HP_COLUMNDEF> columndef;
691
689
  std::vector<HP_KEYDEF> keydef;
692
690
  char buff[FN_REFLEN];
693
691
  int error;
703
701
  if (num_rows > UINT32_MAX)
704
702
    return -1;
705
703
 
706
 
  columndef.resize(column_count);
707
 
 
708
 
  for (uint32_t column_idx= 0; column_idx < column_count; column_idx++)
709
 
  {
710
 
    Field* field= *(table_arg->getFields() + column_idx);
711
 
    HP_COLUMNDEF* column= &columndef[column_idx];
712
 
    column->type= (uint16_t)field->type();
713
 
    column->length= field->pack_length();
714
 
    column->offset= field->offset(field->getTable()->getInsertRecord());
715
 
 
716
 
    if (field->null_bit)
717
 
    {
718
 
      column->null_bit= field->null_bit;
719
 
      column->null_pos= (uint) (field->null_ptr - (unsigned char*) table_arg->getInsertRecord());
720
 
    }
721
 
    else
722
 
    {
723
 
      column->null_bit= 0;
724
 
      column->null_pos= 0;
725
 
    }
726
 
 
727
 
    if (field->type() == DRIZZLE_TYPE_VARCHAR)
728
 
    {
729
 
      column->length_bytes= (uint8_t)(((Field_varstring*)field)->length_bytes);
730
 
    }
731
 
    else
732
 
    {
733
 
      column->length_bytes= 0;
734
 
    }
735
 
  }
736
 
 
737
704
  for (key= parts= 0; key < keys; key++)
738
705
    parts+= table_arg->key_info[key].key_parts;
739
706
 
752
719
    keydef[key].flag=      (pos->flags & (HA_NOSAME | HA_NULL_ARE_EQUAL));
753
720
    keydef[key].seg=       seg;
754
721
 
755
 
    // case HA_KEY_ALG_HASH:
756
 
    keydef[key].algorithm= HA_KEY_ALG_HASH;
757
722
    mem_per_row_keys+= sizeof(char*) * 2; // = sizeof(HASH_INFO)
758
723
 
759
724
    for (; key_part != key_part_end; key_part++, seg++)
837
802
  hp_create_info.with_auto_increment= found_real_auto_increment;
838
803
  hp_create_info.internal_table= internal_table;
839
804
  hp_create_info.max_chunk_size= table_arg->getShare()->block_size;
840
 
  hp_create_info.is_dynamic= false;
841
805
 
842
806
  error= heap_create(internal::fn_format(buff,table_name,"","",
843
807
                              MY_REPLACE_EXT|MY_UNPACK_FILENAME),
844
808
                    keys, &keydef[0],
845
 
                    column_count, &columndef[0],
846
 
                    max_key_fieldnr, key_part_size,
 
809
                    column_count,
 
810
                    key_part_size,
847
811
                    table_arg->getShare()->getRecordLength(), mem_per_row_keys,
848
812
                    static_cast<uint32_t>(num_rows), /* We check for overflow above, so cast is fine here. */
849
813
                    0, // Factor out MIN