~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_insert.cc

  • Committer: Padraig O'Sullivan
  • Date: 2009-04-08 23:01:10 UTC
  • mto: (971.1.63 mordred)
  • mto: This revision was merged to the branch mainline in revision 990.
  • Revision ID: osullivan.padraig@gmail.com-20090408230110-k3x7ix1321lfclp7
Various small cleanups to numerous files to now have calls to the correct
methods in std::bitset instead of calls to functions related to MY_BITSET
e.g. bitmap->test(pos) instead of is_bitmap_set(MY_BITMAP, pos)
Quite a number of files are modified in this commit but most of the
modifications are quite small in nature.

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
      No fields are provided so all fields must be provided in the values.
80
80
      Thus we set all bits in the write set.
81
81
    */
82
 
    bitmap_set_all(table->write_set);
 
82
    table->write_set->set();
83
83
  }
84
84
  else
85
85
  {                                             // Part field list
120
120
    }
121
121
    if (table->timestamp_field) // Don't automaticly set timestamp if used
122
122
    {
123
 
      if (bitmap_is_set(table->write_set,
124
 
                        table->timestamp_field->field_index))
 
123
      if (table->write_set->test(table->timestamp_field->field_index))
125
124
        clear_timestamp_auto_bits(table->timestamp_field_type,
126
125
                                  TIMESTAMP_AUTO_SET_ON_INSERT);
127
126
      else
128
127
      {
129
 
        bitmap_set_bit(table->write_set,
130
 
                       table->timestamp_field->field_index);
 
128
        table->write_set->set(table->timestamp_field->field_index);
131
129
      }
132
130
    }
133
131
    /* Mark all virtual columns for write*/
171
169
      Unmark the timestamp field so that we can check if this is modified
172
170
      by update_fields
173
171
    */
174
 
    timestamp_mark= bitmap_test_and_clear(table->write_set,
175
 
                                          table->timestamp_field->field_index);
 
172
    timestamp_mark= table->write_set->test(table->timestamp_field->field_index);
 
173
    table->write_set->reset(table->timestamp_field->field_index);
176
174
  }
177
175
 
178
176
  /* Check the fields we are going to modify */
182
180
  if (table->timestamp_field)
183
181
  {
184
182
    /* Don't set timestamp column if this is modified. */
185
 
    if (bitmap_is_set(table->write_set,
186
 
                      table->timestamp_field->field_index))
 
183
    if (table->write_set->test(table->timestamp_field->field_index))
187
184
      clear_timestamp_auto_bits(table->timestamp_field_type,
188
185
                                TIMESTAMP_AUTO_SET_ON_UPDATE);
189
186
    if (timestamp_mark)
190
 
      bitmap_set_bit(table->write_set,
191
 
                     table->timestamp_field->field_index);
 
187
      table->write_set->set(table->timestamp_field->field_index);
192
188
  }
193
189
  return 0;
194
190
}
695
691
 
696
692
 
697
693
/*
 
694
 * This helper function returns true if map1 is a subset of
 
695
 * map2; otherwise it returns false.
 
696
 */
 
697
static bool is_bitmap_subset(bitset<MAX_FIELDS> *map1, bitset<MAX_FIELDS> *map2)
 
698
{
 
699
  bitset<MAX_FIELDS> tmp1= *map2;
 
700
  tmp1.flip();
 
701
  bitset<MAX_FIELDS> tmp2= *map1 & tmp1;
 
702
  return (!tmp2.any());
 
703
}
 
704
 
 
705
/*
698
706
  Write a record to table with optional deleting of conflicting records,
699
707
  invoke proper triggers if needed.
700
708
 
832
840
            table->next_number_field->val_int());
833
841
        info->touched++;
834
842
        if ((table->file->ha_table_flags() & HA_PARTIAL_COLUMN_READ &&
835
 
             !bitmap_is_subset(table->write_set, table->read_set)) ||
 
843
             !is_bitmap_subset(table->write_set, table->read_set)) ||
836
844
            table->compare_record())
837
845
        {
838
846
          if ((error=table->file->ha_update_row(table->record[1],
1671
1679
 
1672
1680
  /* Mark all fields that are given values */
1673
1681
  for (Field **f= field ; *f ; f++)
1674
 
    bitmap_set_bit(table->write_set, (*f)->field_index);
 
1682
    table->write_set->set((*f)->field_index);
1675
1683
 
1676
1684
  /* Don't set timestamp if used */
1677
1685
  table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET;