summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2022-06-13 15:31:53 -0700
committerIgor Babaev <igor@askmonty.org>2022-06-13 15:31:53 -0700
commit67585abefca3911dd6ebf36824bf352565b883f5 (patch)
treec4a683f21c095e1e09c45540b1761c4778509338 /sql/sql_base.cc
parent31c01a5b28fc59479755cab5098b3d13e55f732b (diff)
downloadmariadb-git-bb-10.7-mdev-27159.tar.gz
MDEV-27159 Re-design the upper level of handling DML commandsbb-10.7-mdev-27159
This is the second commit for the task. This patch allows to execute only single-table and multi-table DELETE statements using the method Sql_cmd_dml::execute(). The code that handles INSERT statements has not been touched. This patch still does not have the final changes to handle UPDATE/DELETE statements. All tests from the main suite passed. With --ps-protocol one test from opt_trace_security returns not the same result. This will be fixed soon.
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 6883fb1af13..309ed38b5ca 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1074,7 +1074,9 @@ TABLE_LIST* find_dup_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list,
*/
if (table->table &&
thd->lex->sql_command != SQLCOM_UPDATE &&
- thd->lex->sql_command != SQLCOM_UPDATE_MULTI)
+ thd->lex->sql_command != SQLCOM_UPDATE_MULTI &&
+ thd->lex->sql_command != SQLCOM_DELETE &&
+ thd->lex->sql_command != SQLCOM_DELETE_MULTI)
{
/* All MyISAMMRG children are plain MyISAM tables. */
DBUG_ASSERT(table->table->file->ht->db_type != DB_TYPE_MRG_MYISAM);
@@ -7570,6 +7572,9 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
if (!select_lex->with_wild)
DBUG_RETURN(0);
+ if (!fields.elements)
+ DBUG_RETURN(0);
+
/*
Don't use arena if we are not in prepared statements or stored procedures
For PS/SP we have to use arena to remember the changes
@@ -7872,7 +7877,7 @@ bool setup_tables(THD *thd, Name_resolution_context *context,
while ((table_list= ti++))
{
TABLE *table= table_list->table;
- if (table)
+ if (table && !table->pos_in_table_list)
table->pos_in_table_list= table_list;
if (first_select_table &&
table_list->top_table() == first_select_table)
@@ -7888,7 +7893,7 @@ bool setup_tables(THD *thd, Name_resolution_context *context,
}
else if (table)
{
- table->pos_in_table_list= table_list;
+ // table->pos_in_table_list= table_list;
setup_table_map(table, table_list, tablenr);
if (table_list->process_index_hints(table))