diff options
author | monty@mysql.com <> | 2004-08-24 18:00:45 +0300 |
---|---|---|
committer | monty@mysql.com <> | 2004-08-24 18:00:45 +0300 |
commit | c44d4debfab6e1b6259d12682c8ad65d07bb3874 (patch) | |
tree | 0889ac56857787d5328320949bb6d8339acf6407 /sql/sql_table.cc | |
parent | 3808e4a5cfa62e718c4624bf0df108b078ec3432 (diff) | |
download | mariadb-git-c44d4debfab6e1b6259d12682c8ad65d07bb3874.tar.gz |
Portablity fixes & simple optimizations
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 03777daa9b0..408f3408346 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3281,7 +3281,7 @@ copy_data_between_tables(TABLE *from,TABLE *to, ha_rows *deleted) { int error; - Copy_field *copy,*copy_end, *next_field= 0; + Copy_field *copy,*copy_end; ulong found_count,delete_count; THD *thd= current_thd; uint length; @@ -3291,6 +3291,7 @@ copy_data_between_tables(TABLE *from,TABLE *to, List<Item> fields; List<Item> all_fields; ha_rows examined_rows; + bool auto_increment_field_copied= 0; DBUG_ENTER("copy_data_between_tables"); if (!(copy= new Copy_field[to->fields])) @@ -3309,7 +3310,7 @@ copy_data_between_tables(TABLE *from,TABLE *to, if (def->field) { if (*ptr == to->next_number_field) - next_field= copy_end; + auto_increment_field_copied= TRUE; (copy_end++)->set(*ptr,def->field,0); } @@ -3368,11 +3369,14 @@ copy_data_between_tables(TABLE *from,TABLE *to, } thd->row_count++; if (to->next_number_field) - to->next_number_field->reset(); - for (Copy_field *copy_ptr=copy ; copy_ptr != copy_end ; copy_ptr++) { - if (copy_ptr == next_field) + if (auto_increment_field_copied) to->auto_increment_field_not_null= TRUE; + else + to->next_number_field->reset(); + } + for (Copy_field *copy_ptr=copy ; copy_ptr != copy_end ; copy_ptr++) + { copy_ptr->do_copy(copy_ptr); } if ((error=to->file->write_row((byte*) to->record[0]))) |