| 1910 | */ |
| 1911 | |
| 1912 | int multi_update::prepare(List<Item> ¬_used_values, |
| 1913 | SELECT_LEX_UNIT *lex_unit) |
| 1914 | |
| 1915 | { |
| 1916 | TABLE_LIST *table_ref; |
| 1917 | SQL_I_List<TABLE_LIST> update_list; |
| 1918 | Item *item; |
| 1919 | List_iterator_fast<Item> field_it(*fields); |
| 1920 | List_iterator_fast<Item> value_it(*values); |
| 1921 | uint i, max_fields; |
| 1922 | uint leaf_table_count= 0; |
| 1923 | List_iterator<TABLE_LIST> update_targets_iter(update_targets); |
| 1924 | DBUG_ENTER("multi_update::prepare"); |
| 1925 | |
| 1926 | if (prepared) |
| 1927 | DBUG_RETURN(0); |
| 1928 | prepared= true; |
| 1929 | |
| 1930 | thd->count_cuted_fields= CHECK_FIELD_WARN; |
| 1931 | thd->cuted_fields=0L; |
| 1932 | THD_STAGE_INFO(thd, stage_updating_main_table); |
| 1933 | |
| 1934 | #ifdef WITH_WSREP |
| 1935 | if (WSREP(thd) && |
| 1936 | (wsrep_max_ws_rows || wsrep_max_ws_size != WSREP_MAX_WS_SIZE)) |
| 1937 | { |
| 1938 | int trans{0}; |
| 1939 | while (TABLE_LIST *tablel= update_targets_iter++) |
| 1940 | trans|= 1 << tablel->table->file->has_transactions_and_rollback(); |
| 1941 | update_targets_iter.rewind(); |
| 1942 | /* In multi-table update Galera does not support update to both |
| 1943 | transactional and non-transactional engines if write-set |
| 1944 | size is limited. */ |
| 1945 | if (trans == 3) |
| 1946 | { |
| 1947 | my_error(ER_GALERA_REPLICATION_NOT_SUPPORTED, MYF(0)); |
| 1948 | push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, |
| 1949 | ER_GALERA_REPLICATION_NOT_SUPPORTED, |
| 1950 | "Galera does not support multi-table update" |
| 1951 | " to both transactional and non-transactional engines" |
| 1952 | " if write-set size is limited."); |
| 1953 | DBUG_RETURN(1); |
| 1954 | } |
| 1955 | } |
| 1956 | #endif /* WITH_WSREP */ |
| 1957 | |
| 1958 | /* |
| 1959 | We gather the set of columns read during evaluation of SET expression in |
| 1960 | TABLE::tmp_set by pointing TABLE::read_set to it and then restore it after |
| 1961 | setup_fields(). |
| 1962 | */ |
| 1963 | while ((table_ref= update_targets_iter++)) |
| 1964 | { |
| 1965 | TABLE *table= table_ref->table; |
| 1966 | DBUG_ASSERT(table->read_set == &table->def_read_set); |
| 1967 | table->read_set= &table->tmp_set; |
| 1968 | bitmap_clear_all(table->read_set); |
| 1969 | } |
no test coverage detected