~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_update.cc

  • Committer: Monty Taylor
  • Date: 2010-11-25 01:53:19 UTC
  • mto: (1953.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1955.
  • Revision ID: mordred@inaugust.com-20101125015319-ia85msn25uemopgc
Re-enabled -Wformat and then cleaned up the carnage.

Show diffs side-by-side

added added

removed removed

Lines of Context:
98
98
  /* Copy the newly read columns into the new record. */
99
99
  for (field_p= table->getFields(); (field= *field_p); field_p++)
100
100
  {
101
 
    if (unique_map.test(field->position()))
 
101
    if (unique_map.test(field->field_index))
102
102
    {
103
103
      field->copy_from_tmp(table->getShare()->rec_buff_length);
104
104
    }
136
136
  bool          using_limit= limit != HA_POS_ERROR;
137
137
  bool          used_key_is_modified;
138
138
  bool          transactional_table;
 
139
  bool          can_compare_record;
139
140
  int           error;
140
141
  uint          used_index= MAX_KEY, dup_key_found;
141
142
  bool          need_sort= true;
189
190
      if (table->timestamp_field_type == TIMESTAMP_AUTO_SET_ON_UPDATE ||
190
191
          table->timestamp_field_type == TIMESTAMP_AUTO_SET_ON_BOTH)
191
192
      {
192
 
        table->setWriteSet(table->timestamp_field->position());
 
193
        table->setWriteSet(table->timestamp_field->field_index);
193
194
      }
194
195
    }
195
196
  }
458
459
  if (table->cursor->getEngine()->check_flag(HTON_BIT_PARTIAL_COLUMN_READ))
459
460
    table->prepare_for_position();
460
461
 
 
462
  /*
 
463
    We can use compare_record() to optimize away updates if
 
464
    the table handler is returning all columns OR if
 
465
    if all updated columns are read
 
466
  */
 
467
  can_compare_record= (! (table->cursor->getEngine()->check_flag(HTON_BIT_PARTIAL_COLUMN_READ)) ||
 
468
                       table->write_set->is_subset_of(*table->read_set));
 
469
 
461
470
  while (not (error=info.read_record(&info)) && not session->getKilled())
462
471
  {
463
472
    if (not (select && select->skip_record()))
467
476
 
468
477
      table->storeRecord();
469
478
      if (fill_record(session, fields, values))
 
479
      {
 
480
        /*
 
481
         * If we updated some rows before this one failed (updated > 0),
 
482
         * then we will need to undo adding those records to the
 
483
         * replication Statement message.
 
484
         */
 
485
        if (updated > 0)
 
486
        {
 
487
          TransactionServices &ts= TransactionServices::singleton();
 
488
          ts.removeStatementRecords(session, updated);
 
489
        }
 
490
 
470
491
        break;
 
492
      }
471
493
 
472
494
      found++;
473
495
 
474
 
      if (! table->records_are_comparable() || table->compare_records())
 
496
      if (!can_compare_record || table->compare_record())
475
497
      {
476
498
        /* Non-batched update */
477
499
        error= table->cursor->updateRecord(table->getUpdateRecord(),