sql_update.cc | sql_update.cc | |||
---|---|---|---|---|
skipping to change at line 596 | skipping to change at line 596 | |||
*/ | */ | |||
table->prepare_for_position(); | table->prepare_for_position(); | |||
IO_CACHE tempfile; | IO_CACHE tempfile; | |||
if (open_cached_file(&tempfile, mysql_tmpdir,TEMP_PREFIX, | if (open_cached_file(&tempfile, mysql_tmpdir,TEMP_PREFIX, | |||
DISK_BUFFER_SIZE, MYF(MY_WME))) | DISK_BUFFER_SIZE, MYF(MY_WME))) | |||
goto exit_without_my_ok; | goto exit_without_my_ok; | |||
/* If quick select is used, initialize it before retrieving rows. */ | /* If quick select is used, initialize it before retrieving rows. */ | |||
if (select && select->quick && select->quick->reset()) | if (select && select->quick && select->quick->reset()) | |||
{ | ||||
close_cached_file(&tempfile); | ||||
goto exit_without_my_ok; | goto exit_without_my_ok; | |||
} | ||||
table->file->try_semi_consistent_read(1); | table->file->try_semi_consistent_read(1); | |||
/* | /* | |||
When we get here, we have one of the following options: | When we get here, we have one of the following options: | |||
A. used_index == MAX_KEY | A. used_index == MAX_KEY | |||
This means we should use full table scan, and start it with | This means we should use full table scan, and start it with | |||
init_read_record call | init_read_record call | |||
B. used_index != MAX_KEY | B. used_index != MAX_KEY | |||
B.1 quick select is used, start the scan with init_read_record | B.1 quick select is used, start the scan with init_read_record | |||
B.2 quick select is not used, this is full index scan (with LIMI T) | B.2 quick select is not used, this is full index scan (with LIMI T) | |||
skipping to change at line 628 | skipping to change at line 631 | |||
THD_STAGE_INFO(thd, stage_searching_rows_for_update); | THD_STAGE_INFO(thd, stage_searching_rows_for_update); | |||
ha_rows tmp_limit= limit; | ha_rows tmp_limit= limit; | |||
while (!(error=info.read_record(&info)) && !thd->killed) | while (!(error=info.read_record(&info)) && !thd->killed) | |||
{ | { | |||
thd->inc_examined_row_count(1); | thd->inc_examined_row_count(1); | |||
bool skip_record= FALSE; | bool skip_record= FALSE; | |||
if (select && select->skip_record(thd, &skip_record)) | if (select && select->skip_record(thd, &skip_record)) | |||
{ | { | |||
error= 1; | error= 1; | |||
table->file->unlock_row(); | /* | |||
Don't try unlocking the row if skip_record reported an error si | ||||
nce | ||||
in this case the transaction might have been rolled back alread | ||||
y. | ||||
*/ | ||||
break; | break; | |||
} | } | |||
if (!skip_record) | if (!skip_record) | |||
{ | { | |||
if (table->file->was_semi_consistent_read()) | if (table->file->was_semi_consistent_read()) | |||
continue; /* repeat the read of the same row if it still exists */ | continue; /* repeat the read of the same row if it still exists */ | |||
table->file->position(table->record[0]); | table->file->position(table->record[0]); | |||
if (my_b_write(&tempfile,table->file->ref, | if (my_b_write(&tempfile,table->file->ref, | |||
table->file->ref_length)) | table->file->ref_length)) | |||
skipping to change at line 877 | skipping to change at line 883 | |||
limit= dup_key_found; //limit is 0 when we get here so need to + | limit= dup_key_found; //limit is 0 when we get here so need to + | |||
updated-= dup_key_found; | updated-= dup_key_found; | |||
} | } | |||
else | else | |||
{ | { | |||
error= -1; // Simulate end of file | error= -1; // Simulate end of file | |||
break; | break; | |||
} | } | |||
} | } | |||
} | } | |||
else | /* | |||
Don't try unlocking the row if skip_record reported an error since in | ||||
this case the transaction might have been rolled back already. | ||||
*/ | ||||
else if (!thd->is_error()) | ||||
table->file->unlock_row(); | table->file->unlock_row(); | |||
else | ||||
{ | ||||
error= 1; | ||||
break; | ||||
} | ||||
thd->get_stmt_da()->inc_current_row_for_warning(); | thd->get_stmt_da()->inc_current_row_for_warning(); | |||
if (thd->is_error()) | if (thd->is_error()) | |||
{ | { | |||
error= 1; | error= 1; | |||
break; | break; | |||
} | } | |||
} | } | |||
table->auto_increment_field_not_null= FALSE; | table->auto_increment_field_not_null= FALSE; | |||
dup_key_found= 0; | dup_key_found= 0; | |||
/* | /* | |||
End of changes. 5 change blocks. | ||||
2 lines changed or deleted | 19 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |