~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table.cc

  • Committer: Brian Aker
  • Date: 2009-05-06 06:59:53 UTC
  • mfrom: (1003.1.20 merge)
  • Revision ID: brian@gaz-20090506065953-4mrfmaty42e0ixpq
Merge handler cleanup (and ALTER TABLE cleanup) We go from 1 and 2 half
thought out systems... to just 1.

This should all be changed when we finish the StorageEngine rewrite

Show diffs side-by-side

added added

removed removed

Lines of Context:
2632
2632
  if ((file->ha_table_flags() & HA_PRIMARY_KEY_IN_READ_INDEX) &&
2633
2633
      s->primary_key < MAX_KEY)
2634
2634
  {
2635
 
    mark_columns_used_by_index_no_reset(s->primary_key, read_set);
 
2635
    mark_columns_used_by_index_no_reset(s->primary_key);
2636
2636
  }
2637
2637
  return;
2638
2638
}
2684
2684
  mark columns used by key, but don't reset other fields
2685
2685
*/
2686
2686
 
 
2687
void Table::mark_columns_used_by_index_no_reset(uint32_t index)
 
2688
{
 
2689
    mark_columns_used_by_index_no_reset(index, read_set);
 
2690
}
 
2691
 
2687
2692
void Table::mark_columns_used_by_index_no_reset(uint32_t index,
2688
2693
                                                bitset<MAX_FIELDS> *bitmap)
2689
2694
{
2713
2718
  read_set->set(found_next_number_field->field_index);
2714
2719
  write_set->set(found_next_number_field->field_index);
2715
2720
  if (s->next_number_keypart)
2716
 
    mark_columns_used_by_index_no_reset(s->next_number_index, read_set);
 
2721
    mark_columns_used_by_index_no_reset(s->next_number_index);
2717
2722
}
2718
2723
 
2719
2724
 
2737
2742
 
2738
2743
void Table::mark_columns_needed_for_delete()
2739
2744
{
 
2745
  /*
 
2746
    If the handler has no cursor capabilites, or we have row-based
 
2747
    replication active for the current statement, we have to read
 
2748
    either the primary key, the hidden primary key or all columns to
 
2749
    be able to do an delete
 
2750
 
 
2751
  */
 
2752
  if (s->primary_key == MAX_KEY)
 
2753
  {
 
2754
    /* fallback to use all columns in the table to identify row */
 
2755
    use_all_columns();
 
2756
    return;
 
2757
  }
 
2758
  else
 
2759
    mark_columns_used_by_index_no_reset(s->primary_key);
 
2760
 
 
2761
  /* If we the engine wants all predicates we mark all keys */
2740
2762
  if (file->ha_table_flags() & HA_REQUIRES_KEY_COLUMNS_FOR_DELETE)
2741
2763
  {
2742
2764
    Field **reg_field;
2746
2768
        read_set->set((*reg_field)->field_index);
2747
2769
    }
2748
2770
  }
2749
 
 
2750
 
  {
2751
 
    /*
2752
 
      If the handler has no cursor capabilites, or we have row-based
2753
 
      replication active for the current statement, we have to read
2754
 
      either the primary key, the hidden primary key or all columns to
2755
 
      be able to do an delete
2756
 
    */
2757
 
    if (s->primary_key == MAX_KEY)
2758
 
      file->use_hidden_primary_key();
2759
 
    else
2760
 
      mark_columns_used_by_index_no_reset(s->primary_key, read_set);
2761
 
  }
2762
2771
}
2763
2772
 
2764
2773
 
2782
2791
 
2783
2792
void Table::mark_columns_needed_for_update()
2784
2793
{
 
2794
  /*
 
2795
    If the handler has no cursor capabilites, or we have row-based
 
2796
    logging active for the current statement, we have to read either
 
2797
    the primary key, the hidden primary key or all columns to be
 
2798
    able to do an update
 
2799
  */
 
2800
  if (s->primary_key == MAX_KEY)
 
2801
  {
 
2802
    /* fallback to use all columns in the table to identify row */
 
2803
    use_all_columns();
 
2804
    return;
 
2805
  }
 
2806
  else
 
2807
    mark_columns_used_by_index_no_reset(s->primary_key);
 
2808
 
2785
2809
  if (file->ha_table_flags() & HA_REQUIRES_KEY_COLUMNS_FOR_DELETE)
2786
2810
  {
2787
2811
    /* Mark all used key columns for read */
2794
2818
    }
2795
2819
  }
2796
2820
 
2797
 
  {
2798
 
    /*
2799
 
      If the handler has no cursor capabilites, or we have row-based
2800
 
      logging active for the current statement, we have to read either
2801
 
      the primary key, the hidden primary key or all columns to be
2802
 
      able to do an update
2803
 
    */
2804
 
    if (s->primary_key == MAX_KEY)
2805
 
      file->use_hidden_primary_key();
2806
 
    else
2807
 
      mark_columns_used_by_index_no_reset(s->primary_key, read_set);
2808
 
  }
2809
 
  return;
2810
2821
}
2811
2822
 
2812
2823