~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/heap/ha_heap.cc

  • Committer: Monty Taylor
  • Date: 2010-03-11 18:27:20 UTC
  • mfrom: (1333 staging)
  • mto: This revision was merged to the branch mainline in revision 1348.
  • Revision ID: mordred@inaugust.com-20100311182720-hd1h87y6cb1b1mp0
Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
80
80
 
81
81
  int doRenameTable(Session*, const char * from, const char * to);
82
82
 
83
 
  int doDropTable(Session&, const string table_path);
 
83
  int doDropTable(Session&, const string &table_path);
84
84
 
85
85
  int doGetTableDefinition(Session& session,
86
86
                           const char* path,
135
135
  We have to ignore ENOENT entries as the MEMORY table is created on open and
136
136
  not when doing a CREATE on the table.
137
137
*/
138
 
int HeapEngine::doDropTable(Session&, const string table_path)
 
138
int HeapEngine::doDropTable(Session&, const string &table_path)
139
139
{
140
140
  ProtoCache::iterator iter;
141
141
 
334
334
int ha_heap::write_row(unsigned char * buf)
335
335
{
336
336
  int res;
337
 
  ha_statistic_increment(&SSV::ha_write_count);
 
337
  ha_statistic_increment(&system_status_var::ha_write_count);
338
338
  if (table->next_number_field && buf == table->record[0])
339
339
  {
340
340
    if ((res= update_auto_increment()))
356
356
int ha_heap::update_row(const unsigned char * old_data, unsigned char * new_data)
357
357
{
358
358
  int res;
359
 
  ha_statistic_increment(&SSV::ha_update_count);
 
359
  ha_statistic_increment(&system_status_var::ha_update_count);
360
360
  if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
361
361
    table->timestamp_field->set_time();
362
362
  res= heap_update(file,old_data,new_data);
375
375
int ha_heap::delete_row(const unsigned char * buf)
376
376
{
377
377
  int res;
378
 
  ha_statistic_increment(&SSV::ha_delete_count);
 
378
  ha_statistic_increment(&system_status_var::ha_delete_count);
379
379
  res= heap_delete(file,buf);
380
 
  if (!res && table->s->tmp_table == NO_TMP_TABLE &&
 
380
  if (!res && table->s->tmp_table == STANDARD_TABLE &&
381
381
      ++records_changed*MEMORY_STATS_UPDATE_THRESHOLD > file->s->records)
382
382
  {
383
383
    /*
394
394
                            enum ha_rkey_function find_flag)
395
395
{
396
396
  assert(inited==INDEX);
397
 
  ha_statistic_increment(&SSV::ha_read_key_count);
 
397
  ha_statistic_increment(&system_status_var::ha_read_key_count);
398
398
  int error = heap_rkey(file,buf,active_index, key, keypart_map, find_flag);
399
399
  table->status = error ? STATUS_NOT_FOUND : 0;
400
400
  return error;
404
404
                                 key_part_map keypart_map)
405
405
{
406
406
  assert(inited==INDEX);
407
 
  ha_statistic_increment(&SSV::ha_read_key_count);
 
407
  ha_statistic_increment(&system_status_var::ha_read_key_count);
408
408
  int error= heap_rkey(file, buf, active_index, key, keypart_map,
409
409
                       HA_READ_PREFIX_LAST);
410
410
  table->status= error ? STATUS_NOT_FOUND : 0;
415
415
                                key_part_map keypart_map,
416
416
                                enum ha_rkey_function find_flag)
417
417
{
418
 
  ha_statistic_increment(&SSV::ha_read_key_count);
 
418
  ha_statistic_increment(&system_status_var::ha_read_key_count);
419
419
  int error = heap_rkey(file, buf, index, key, keypart_map, find_flag);
420
420
  table->status = error ? STATUS_NOT_FOUND : 0;
421
421
  return error;
424
424
int ha_heap::index_next(unsigned char * buf)
425
425
{
426
426
  assert(inited==INDEX);
427
 
  ha_statistic_increment(&SSV::ha_read_next_count);
 
427
  ha_statistic_increment(&system_status_var::ha_read_next_count);
428
428
  int error=heap_rnext(file,buf);
429
429
  table->status=error ? STATUS_NOT_FOUND: 0;
430
430
  return error;
433
433
int ha_heap::index_prev(unsigned char * buf)
434
434
{
435
435
  assert(inited==INDEX);
436
 
  ha_statistic_increment(&SSV::ha_read_prev_count);
 
436
  ha_statistic_increment(&system_status_var::ha_read_prev_count);
437
437
  int error=heap_rprev(file,buf);
438
438
  table->status=error ? STATUS_NOT_FOUND: 0;
439
439
  return error;
442
442
int ha_heap::index_first(unsigned char * buf)
443
443
{
444
444
  assert(inited==INDEX);
445
 
  ha_statistic_increment(&SSV::ha_read_first_count);
 
445
  ha_statistic_increment(&system_status_var::ha_read_first_count);
446
446
  int error=heap_rfirst(file, buf, active_index);
447
447
  table->status=error ? STATUS_NOT_FOUND: 0;
448
448
  return error;
451
451
int ha_heap::index_last(unsigned char * buf)
452
452
{
453
453
  assert(inited==INDEX);
454
 
  ha_statistic_increment(&SSV::ha_read_last_count);
 
454
  ha_statistic_increment(&system_status_var::ha_read_last_count);
455
455
  int error=heap_rlast(file, buf, active_index);
456
456
  table->status=error ? STATUS_NOT_FOUND: 0;
457
457
  return error;
464
464
 
465
465
int ha_heap::rnd_next(unsigned char *buf)
466
466
{
467
 
  ha_statistic_increment(&SSV::ha_read_rnd_next_count);
 
467
  ha_statistic_increment(&system_status_var::ha_read_rnd_next_count);
468
468
  int error=heap_scan(file, buf);
469
469
  table->status=error ? STATUS_NOT_FOUND: 0;
470
470
  return error;
474
474
{
475
475
  int error;
476
476
  HEAP_PTR heap_position;
477
 
  ha_statistic_increment(&SSV::ha_read_rnd_count);
 
477
  ha_statistic_increment(&system_status_var::ha_read_rnd_count);
478
478
  memcpy(&heap_position, pos, sizeof(HEAP_PTR));
479
479
  error=heap_rrnd(file, buf, heap_position);
480
480
  table->status=error ? STATUS_NOT_FOUND: 0;
535
535
int ha_heap::delete_all_rows()
536
536
{
537
537
  heap_clear(file);
538
 
  if (table->s->tmp_table == NO_TMP_TABLE)
 
538
  if (table->s->tmp_table == STANDARD_TABLE)
539
539
  {
540
540
    /*
541
541
       We can perform this safely since only one writer at the time is
837
837
        key_part_size= next_field_pos;
838
838
      }
839
839
 
840
 
      if (field->flags & (ENUM_FLAG | SET_FLAG))
 
840
      if (field->flags & ENUM_FLAG)
841
841
        seg->charset= &my_charset_bin;
842
842
      else
843
843
        seg->charset= field->charset();
938
938
  PLUGIN_LICENSE_GPL,
939
939
  heap_init,
940
940
  heap_deinit,
941
 
  NULL,                       /* status variables                */
942
941
  NULL,                       /* system variables                */
943
942
  NULL                        /* config options                  */
944
943
}