MCPcopy Create free account
hub / github.com/MariaDB/server / do_updates

Method do_updates

sql/sql_update.cc:2657–2926  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2655
2656
2657int multi_update::do_updates()
2658{
2659 TABLE_LIST *cur_table;
2660 int local_error= 0;
2661 ha_rows org_updated;
2662 TABLE *table, *tmp_table, *err_table;
2663 List_iterator_fast<TABLE> check_opt_it(unupdated_check_opt_tables);
2664 DBUG_ENTER("multi_update::do_updates");
2665
2666 do_update= 0; // Don't retry this function
2667 if (!found)
2668 DBUG_RETURN(0);
2669
2670 /*
2671 Update read_set to include all fields that virtual columns may depend on.
2672 Usually they're already in the read_set, but if the previous access
2673 method was keyread, only the virtual column itself will be in read_set,
2674 not its dependencies
2675 */
2676 while(TABLE *tbl= check_opt_it++)
2677 if (Field **vf= tbl->vfield)
2678 for (; *vf; vf++)
2679 if (bitmap_is_set(tbl->read_set, (*vf)->field_index))
2680 (*vf)->vcol_info->expr->walk(&Item::register_field_in_read_map,
2681 0, WALK_SUBQUERY);
2682
2683 for (cur_table= update_tables; cur_table; cur_table= cur_table->next_local)
2684 {
2685 bool can_compare_record;
2686 uint offset= cur_table->shared;
2687
2688 table = cur_table->table;
2689 if (table == table_to_update)
2690 continue; // Already updated
2691 org_updated= updated;
2692 tmp_table= tmp_tables[cur_table->shared];
2693 tmp_table->file->extra(HA_EXTRA_CACHE); // Change to read cache
2694 if (unlikely((local_error= table->file->ha_rnd_init(0))))
2695 {
2696 err_table= table;
2697 goto err;
2698 }
2699 table->file->extra(HA_EXTRA_NO_CACHE);
2700 /*
2701 We have to clear the base record, if we have virtual indexed
2702 blob fields, as some storage engines will access the blob fields
2703 to calculate the keys to see if they have changed. Without
2704 clearing the blob pointers will contain random values which can
2705 cause a crash.
2706 This is a workaround for engines that access columns not present in
2707 either read or write set.
2708 */
2709 if (table->vfield)
2710 empty_record(table);
2711
2712 has_vers_fields= table->vers_check_update(*fields);
2713
2714 check_opt_it.rewind();

Callers

nothing calls this directly

Calls 15

bitmap_is_setFunction · 0.85
records_are_comparableFunction · 0.85
vers_insert_history_rowFunction · 0.85
ha_rnd_initMethod · 0.80
vers_check_updateMethod · 0.80
fatal_errorMethod · 0.80
ha_rnd_nextMethod · 0.80
ha_rnd_posMethod · 0.80
update_virtual_fieldsMethod · 0.80

Tested by

no test coverage detected