~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_insert.cc

  • Committer: lbieber
  • Date: 2010-09-11 00:47:34 UTC
  • mfrom: (1756.1.2 build)
  • Revision ID: lbieber@orisndriz03-20100911004734-m5kvdu6q2nq0u43w
Merge Brian - cppcheck fixes and also modifies unique lookup such that we let the OS handle paging for unique checking (instead of trying to mimic it through using a self built IO_CACHE).
Merge Andrew - fix test result for embedded_innodb 

Show diffs side-by-side

added added

removed removed

Lines of Context:
716
716
int write_record(Session *session, Table *table,CopyInfo *info)
717
717
{
718
718
  int error;
719
 
  char *key=0;
 
719
  std::vector<unsigned char> key;
720
720
  MyBitmap *save_read_set, *save_write_set;
721
721
  uint64_t prev_insert_id= table->cursor->next_insert_id;
722
722
  uint64_t insert_id_for_cur_row= 0;
787
787
          goto err;
788
788
        }
789
789
 
790
 
        if (!key)
 
790
        if (not key.size())
791
791
        {
792
 
          if (!(key=(char*) malloc(table->getShare()->max_unique_length)))
793
 
          {
794
 
            error=ENOMEM;
795
 
            goto err;
796
 
          }
 
792
          key.resize(table->getShare()->max_unique_length);
797
793
        }
798
 
        key_copy((unsigned char*) key,table->getInsertRecord(),table->key_info+key_nr,0);
 
794
        key_copy(&key[0], table->getInsertRecord(), table->key_info+key_nr, 0);
799
795
        if ((error=(table->cursor->index_read_idx_map(table->getUpdateRecord(),key_nr,
800
 
                                                    (unsigned char*) key, HA_WHOLE_KEY,
 
796
                                                    &key[0], HA_WHOLE_KEY,
801
797
                                                    HA_READ_KEY_EXACT))))
802
798
          goto err;
803
799
      }
931
927
  session->record_first_successful_insert_id_in_cur_stmt(table->cursor->insert_id_for_cur_row);
932
928
 
933
929
gok_or_after_err:
934
 
  if (key)
935
 
    free(key);
936
930
  if (!table->cursor->has_transactions())
937
931
    session->transaction.stmt.markModifiedNonTransData();
938
932
  return(0);
946
940
 
947
941
before_err:
948
942
  table->cursor->restore_auto_increment(prev_insert_id);
949
 
  if (key)
950
 
    free(key);
951
943
  table->column_bitmaps_set(save_read_set, save_write_set);
952
944
  return(1);
953
945
}