23#ifndef SQL_UPDATE_INCLUDED
24#define SQL_UPDATE_INCLUDED
This class encapsulates a data change operation.
Definition: sql_data_change.h:73
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:850
Definition: sql_optimizer.h:125
Definition: sql_list.h:433
This class represents a query block, aka a query specification, which is a query consisting of a SELE...
Definition: sql_lex.h:1153
This class represents a query expression (one query block or several query blocks combined with UNION...
Definition: sql_lex.h:623
Definition: query_result.h:173
Definition: sql_update.h:56
Table_ref * update_tables
Pointer to list of updated tables, linked via 'next_local'.
Definition: sql_update.h:60
Copy_field * copy_field
???
Definition: sql_update.h:89
bool do_updates(THD *thd)
const mem_root_deque< Item * > * values
List of pointers to values to update with, in order from statement.
Definition: sql_update.h:78
TABLE * table_to_update
In a multi-table update, this is equal to the first table in the join operation (main_table) if that ...
Definition: sql_update.h:74
bool need_explain_interceptor() const override
Definition: sql_update.h:111
mem_root_deque< Item * > ** fields_for_table
The fields list decomposed into separate lists per table.
Definition: sql_update.h:80
Temp_table_param * tmp_table_param
Array of parameter structs for creation of temporary tables.
Definition: sql_update.h:64
unique_ptr_destroy_only< RowIterator > create_iterator(THD *thd, MEM_ROOT *mem_root, unique_ptr_destroy_only< RowIterator > source)
Definition: sql_update.cc:3066
bool prepare(THD *thd, const mem_root_deque< Item * > &list, Query_expression *u) override
Perform preparation specific to the query expression or DML statement.
Definition: sql_update.cc:1823
TABLE ** tmp_tables
Array of references to temporary tables used to store cached updates.
Definition: sql_update.h:62
bool start_execution(THD *thd) override
Prepare for execution of the query expression or DML statement.
Definition: sql_update.cc:2374
List< TABLE > unupdated_check_opt_tables
List of tables referenced in the CHECK OPTION condition of the updated view excluding the updated tab...
Definition: sql_update.h:87
bool send_data(THD *thd, const mem_root_deque< Item * > &items) override
Definition: sql_update.cc:2408
COPY_INFO ** update_operations
Array of update operations, arranged per updated table.
Definition: sql_update.h:105
const mem_root_deque< Item * > * fields
List of pointers to fields to update, in order from statement.
Definition: sql_update.h:76
bool send_eof(THD *thd) override
Definition: sql_update.cc:2938
void cleanup() override
Cleanup after this execution.
Definition: sql_update.cc:2380
TABLE * main_table
The first table in the join operation.
Definition: sql_update.h:66
bool optimize()
Set up data structures for multi-table UPDATE.
Definition: sql_update.cc:2180
uint update_table_count
Number of tables being updated.
Definition: sql_update.h:58
mem_root_deque< Item * > ** values_for_table
The values list decomposed into separate lists per table.
Definition: sql_update.h:82
Query_result_update(mem_root_deque< Item * > *field_list, mem_root_deque< Item * > *value_list)
Definition: sql_update.h:108
A context for reading through a single table using a chosen access method: index read,...
Definition: row_iterator.h:81
Abstract base class for traversing the Query_block tree.
Definition: select_lex_visitor.h:39
Definition: sql_cmd_dml.h:34
Definition: sql_update.h:125
bool precheck(THD *thd) override
Perform a precheck of table privileges for the specific operation.
Definition: sql_update.cc:127
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: sql_update.h:132
bool prepare_inner(THD *thd) override
Perform the command-specific parts of DML command preparation, to be called from prepare()
Definition: sql_update.cc:1467
Sql_cmd_update(bool multitable_arg, mem_root_deque< Item * > *update_values)
Definition: sql_update.h:127
bool check_privileges(THD *thd) override
Check privileges on a prepared statement, called at start of execution of the statement.
Definition: sql_update.cc:193
mem_root_deque< Item * > * update_value_list
The values used to update fields.
Definition: sql_update.h:163
table_map tables_for_update
Bitmap of all tables which are to be updated.
Definition: sql_update.h:152
bool multitable
Definition: sql_update.h:149
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_update.cc:1800
mem_root_deque< Item * > original_fields
The original list of fields to update, used for privilege checking.
Definition: sql_update.h:161
bool update_single_table(THD *thd)
Perform an update to a set of rows in a single table.
Definition: sql_update.cc:366
bool is_single_table_plan() const override
Definition: sql_update.h:136
bool make_base_table_fields(THD *thd, mem_root_deque< Item * > *items)
Convert list of fields to update to base table fields.
Definition: sql_update.cc:310
bool accept(THD *thd, Select_lex_visitor *visitor) override
Definition: sql_update.cc:2959
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:33
TABLE * table
Definition: table.h:3529
Object containing parameters used when creating and using temporary tables.
Definition: temp_table_param.h:94
A (partial) implementation of std::deque allocating its blocks on a MEM_ROOT.
Definition: mem_root_deque.h:109
static MEM_ROOT mem_root
Definition: client_plugin.cc:109
This file follows Google coding style, except for the name MEM_ROOT (which is kept for historical rea...
std::unique_ptr< T, Destroy_only< T > > unique_ptr_destroy_only
std::unique_ptr, but only destroying.
Definition: my_alloc.h:488
enum_sql_command
Definition: my_sqlcommand.h:45
@ SQLCOM_UPDATE
Definition: my_sqlcommand.h:50
@ SQLCOM_UPDATE_MULTI
Definition: my_sqlcommand.h:121
uint64_t table_map
Definition: my_table_map.h:29
thread_local MEM_ROOT ** THR_MALLOC
Definition: mysqld.cc:1551
std::string join(Container cont, const std::string &delim)
join elements of an container into a string separated by a delimiter.
Definition: string.h:150
std::list< T, ut::allocator< T > > list
Specialization of list which uses ut_allocator.
Definition: ut0new.h:2876
repeated Source source
Definition: replication_asynchronous_connection_failover.proto:41
bool records_are_comparable(const TABLE *table)
True if the table's input and output record buffers are comparable using compare_records(TABLE*).
Definition: sql_update.cc:236
table_map GetImmediateUpdateTable(const JOIN *join, bool single_target)
Find out which of the target tables can be updated immediately while scanning.
Definition: sql_update.cc:2991
unique_ptr_destroy_only< RowIterator > CreateUpdateRowsIterator(THD *thd, MEM_ROOT *mem_root, JOIN *join, unique_ptr_destroy_only< RowIterator > source)
Creates an UpdateRowsIterator which updates the rows returned by the given "source" iterator.
Definition: sql_update.cc:3059
bool FinalizeOptimizationForUpdate(JOIN *join)
Makes the TABLE and handler objects ready for being used in an UPDATE statement.
Definition: sql_update.cc:3033
bool compare_records(const TABLE *table)
Compares the input and output record buffers of the table to see if a row has changed.
Definition: sql_update.cc:254
bool should_switch_to_multi_table_if_subqueries(const THD *thd, const Query_block *select, const Table_ref *table_list)
Decides if a single-table UPDATE/DELETE statement should switch to the multi-table code path,...
Definition: sql_update.cc:1434
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:82
unsigned int uint
Definition: uca-dump.cc:29