summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2004-11-21 20:08:12 +0200
committerunknown <bell@sanja.is.com.ua>2004-11-21 20:08:12 +0200
commit5a00a868b74ffb6b220eb72c87ec38696ce9406c (patch)
tree76a673d7a9b20f184988993cc14ce455b1d73f70 /sql/sql_parse.cc
parent436c7714dd6df991f2e968b313906d4b1e70db97 (diff)
parentc9497e2365461fb2547a8cfceb33b68a99d7fe0b (diff)
downloadmariadb-git-5a00a868b74ffb6b220eb72c87ec38696ce9406c.tar.gz
merge
sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.h: Auto merged sql/item_subselect.cc: Auto merged sql/mysql_priv.h: Auto merged sql/opt_sum.cc: Auto merged sql/sp.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_delete.cc: Auto merged sql/sql_help.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_load.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_view.h: Auto merged sql/sql_yacc.yy: Auto merged
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc58
1 files changed, 35 insertions, 23 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 7781ceac9e2..ca19f982826 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2882,12 +2882,19 @@ create_error:
(ORDER *) select_lex->order_list.first,
select_lex->select_limit,
lex->duplicates);
- break;
+ if (res != 2)
+ break;
case SQLCOM_UPDATE_MULTI:
{
DBUG_ASSERT(first_table == all_tables && first_table != 0);
- if ((res= multi_update_precheck(thd, all_tables)))
- break;
+ if (res != 2)
+ {
+ if ((res= multi_update_precheck(thd, all_tables)))
+ break;
+ }
+ else
+ res= 0;
+
res= mysql_multi_update(thd, all_tables,
&select_lex->item_list,
&lex->value_list,
@@ -2929,35 +2936,28 @@ create_error:
if (!(res= open_and_lock_tables(thd, all_tables)))
{
- /*
- Is table which we are changing used somewhere in other parts of
- query
- */
- if (unique_table(first_table, all_tables->next_global))
- {
- /* Using same table for INSERT and SELECT */
- select_lex->options |= OPTION_BUFFER_RESULT;
- }
+ /* Skip first table, which is the table we are inserting in */
+ lex->select_lex.table_list.first= (byte*)first_table->next_local;
- if ((res= mysql_insert_select_prepare(thd)))
- break;
- if ((result= new select_insert(first_table, first_table->table,
- &lex->field_list, lex->duplicates,
- lex->duplicates == DUP_IGNORE)))
+ res= mysql_insert_select_prepare(thd);
+ if (!res && (result= new select_insert(first_table, first_table->table,
+ &lex->field_list,
+ lex->duplicates,
+ lex->duplicates == DUP_IGNORE)))
{
- /* Skip first table, which is the table we are inserting in */
- lex->select_lex.table_list.first= (byte*) first_table->next_local;
+ TABLE_LIST *first_select_table;
+
/*
insert/replace from SELECT give its SELECT_LEX for SELECT,
and item_list belong to SELECT
*/
lex->select_lex.resolve_mode= SELECT_LEX::SELECT_MODE;
res= handle_select(thd, lex, result);
- /* revert changes for SP */
- lex->select_lex.table_list.first= (byte*) first_table;
lex->select_lex.resolve_mode= SELECT_LEX::INSERT_MODE;
delete result;
}
+ /* revert changes for SP */
+ lex->select_lex.table_list.first= (byte*) first_table;
}
else
res= TRUE;
@@ -3012,8 +3012,20 @@ create_error:
goto error;
thd->proc_info="init";
- if ((res= open_and_lock_tables(thd, all_tables)) ||
- (res= mysql_multi_delete_prepare(thd)))
+ if ((res= open_and_lock_tables(thd, all_tables)))
+ break;
+
+ if (!first_table->table)
+ {
+ DBUG_ASSERT(first_table->view &&
+ first_table->ancestor && first_table->ancestor->next_local);
+ my_error(ER_VIEW_DELETE_MERGE_VIEW, MYF(0),
+ first_table->view_db.str, first_table->view_name.str);
+ res= -1;
+ break;
+ }
+
+ if ((res= mysql_multi_delete_prepare(thd)))
goto error;
if (!thd->is_fatal_error && (result= new multi_delete(thd,aux_tables,