~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/heap/ha_heap.cc

Merged in Eric's whitespace cleanup.

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
}
51
51
 
52
52
static handler *heap_create_handler(handlerton *hton,
53
 
                                    TABLE_SHARE *table, 
 
53
                                    TABLE_SHARE *table,
54
54
                                    MEM_ROOT *mem_root)
55
55
{
56
56
  return new (mem_root) ha_heap(hton, table);
62
62
*****************************************************************************/
63
63
 
64
64
ha_heap::ha_heap(handlerton *hton, TABLE_SHARE *table_arg)
65
 
  :handler(hton, table_arg), file(0), records_changed(0), key_stat_version(0), 
 
65
  :handler(hton, table_arg), file(0), records_changed(0), key_stat_version(0),
66
66
  internal_table(0)
67
67
{}
68
68
 
77
77
}
78
78
 
79
79
/*
80
 
  Hash index statistics is updated (copied from HP_KEYDEF::hash_buckets to 
81
 
  rec_per_key) after 1/HEAP_STATS_UPDATE_THRESHOLD fraction of table records 
82
 
  have been inserted/updated/deleted. delete_all_rows() and table flush cause 
 
80
  Hash index statistics is updated (copied from HP_KEYDEF::hash_buckets to
 
81
  rec_per_key) after 1/HEAP_STATS_UPDATE_THRESHOLD fraction of table records
 
82
  have been inserted/updated/deleted. delete_all_rows() and table flush cause
83
83
  immediate update.
84
84
 
85
85
  NOTE
86
86
   hash index statistics must be updated when number of table records changes
87
 
   from 0 to non-zero value and vice versa. Otherwise records_in_range may 
 
87
   from 0 to non-zero value and vice versa. Otherwise records_in_range may
88
88
   erroneously return 0 and 'range' may miss records.
89
89
*/
90
90
#define HEAP_STATS_UPDATE_THRESHOLD 10
140
140
  Create a copy of this table
141
141
 
142
142
  DESCRIPTION
143
 
    Do same as default implementation but use file->s->name instead of 
 
143
    Do same as default implementation but use file->s->name instead of
144
144
    table->s->path. This is needed by Windows where the clone() call sees
145
 
    '/'-delimited path in table->s->path, while ha_peap::open() was called 
 
145
    '/'-delimited path in table->s->path, while ha_peap::open() was called
146
146
    with '\'-delimited path.
147
147
*/
148
148
 
256
256
  if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
257
257
    table->timestamp_field->set_time();
258
258
  res= heap_update(file,old_data,new_data);
259
 
  if (!res && ++records_changed*HEAP_STATS_UPDATE_THRESHOLD > 
 
259
  if (!res && ++records_changed*HEAP_STATS_UPDATE_THRESHOLD >
260
260
              file->s->records)
261
261
  {
262
262
    /*
273
273
  int res;
274
274
  ha_statistic_increment(&SSV::ha_delete_count);
275
275
  res= heap_delete(file,buf);
276
 
  if (!res && table->s->tmp_table == NO_TMP_TABLE && 
 
276
  if (!res && table->s->tmp_table == NO_TMP_TABLE &&
277
277
      ++records_changed*HEAP_STATS_UPDATE_THRESHOLD > file->s->records)
278
278
  {
279
279
    /*
756
756
      }
757
757
    }
758
758
  }
759
 
  
 
759
 
760
760
  if (key_part_size < share->null_bytes + ((share->last_null_bit_pos+7) >> 3))
761
761
  {
762
762
    /* Make sure to include null fields regardless of the presense of keys */
763
763
    key_part_size = share->null_bytes + ((share->last_null_bit_pos+7) >> 3);
764
764
  }
765
765
 
766
 
  
767
 
  
 
766
 
 
767
 
768
768
  if (table_arg->found_next_number_field)
769
769
  {
770
770
    keydef[share->next_number_index].flag|= HA_AUTO_KEY;
788
788
         share->reclength, mem_per_row_keys,
789
789
         (uint32_t) share->max_rows, (uint32_t) share->min_rows,
790
790
         &hp_create_info, &internal_share);
791
 
  
 
791
 
792
792
  free((unsigned char*) keydef);
793
793
  free((void *) columndef);
794
794
  assert(file == 0);