mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Name resolution context added (BUG#6443)
include/my_bitmap.h: new bitmap operation mysql-test/r/view.result: added warnings Correct inserting data check (absence of default value) for view underlying tables (BUG#6443) mysql-test/t/view.test: Correct inserting data check (absence of default value) for view underlying tables (BUG#6443) mysys/my_bitmap.c: new bitmap operation sql/field.h: index of field in table added sql/item.cc: Name resolution context added table list removed from fix_fields() arguments sql/item.h: Name resolution context added table list removed from fix_fields() arguments sql/item_cmpfunc.cc: table list removed from fix_fields() arguments sql/item_cmpfunc.h: table list removed from fix_fields() arguments sql/item_func.cc: table list removed from fix_fields() arguments sql/item_func.h: table list removed from fix_fields() arguments sql/item_row.cc: table list removed from fix_fields() arguments sql/item_row.h: table list removed from fix_fields() arguments sql/item_strfunc.cc: fixed server crash on NULL argument sql/item_strfunc.h: table list removed from fix_fields() arguments sql/item_subselect.cc: table list removed from fix_fields() arguments sql/item_subselect.h: table list removed from fix_fields() arguments sql/item_sum.cc: table list removed from fix_fields() arguments sql/item_sum.h: table list removed from fix_fields() arguments sql/item_timefunc.cc: table list removed from fix_fields() arguments sql/item_timefunc.h: table list removed from fix_fields() arguments sql/item_uniq.h: table list removed from fix_fields() arguments sql/log_event.cc: Name resolution context added sql/log_event.h: Name resolution context added sql/mysql_priv.h: Name resolution context added sql/set_var.cc: table list removed from fix_fields() arguments sql/share/errmsg.txt: new error message sql/sp.cc: Name resolution context added sql/sp_head.cc: table list removed from fix_fields() arguments sql/sp_head.h: Name resolution context added sql/sql_base.cc: table list removed from fix_fields() arguments Name resolution context added sql/sql_class.cc: renamed variable sql/sql_delete.cc: Name resolution context added sql/sql_derived.cc: Name resolution context added sql/sql_do.cc: table list removed from fix_fields() arguments sql/sql_handler.cc: Name resolution context added sql/sql_help.cc: Name resolution context added sql/sql_insert.cc: Name resolution context added table list removed from fix_fields() arguments sql/sql_lex.cc: Name resolution context added sql/sql_lex.h: removed resolve mode (information stored into name resolution context) sql/sql_load.cc: table list removed from fix_fields() arguments sql/sql_olap.cc: Name resolution context added sql/sql_parse.cc: Name resolution context added sql/sql_prepare.cc: table list removed from fix_fields() arguments sql/sql_select.cc: table list removed from fix_fields() arguments sql/sql_show.cc: Name resolution context added sql/sql_trigger.cc: table list removed from fix_fields() arguments sql/sql_udf.h: table list removed from fix_fields() arguments sql/sql_union.cc: Name resolution context added sql/sql_update.cc: Name resolution context added sql/sql_view.cc: Name resolution context added sql/sql_view.h: table list removed from fix_fields() arguments sql/sql_yacc.yy: Name resolution context added sql/table.cc: Name resolution context added merged view processing moved sql/table.h: merged view processing moved
This commit is contained in:
@@ -67,6 +67,8 @@ static bool check_fields(THD *thd, List<Item> &items)
|
||||
List_iterator<Item> it(items);
|
||||
Item *item;
|
||||
Item_field *field;
|
||||
Name_resolution_context *context= &thd->lex->select_lex.context;
|
||||
|
||||
while ((item= it++))
|
||||
{
|
||||
if (!(field= item->filed_for_view_update()))
|
||||
@@ -185,14 +187,8 @@ int mysql_update(THD *thd,
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
table_list->grant.want_privilege= table->grant.want_privilege= want_privilege;
|
||||
#endif
|
||||
{
|
||||
bool res;
|
||||
select_lex->no_wrap_view_item= 1;
|
||||
res= setup_fields(thd, 0, table_list, fields, 1, 0, 0);
|
||||
select_lex->no_wrap_view_item= 0;
|
||||
if (res)
|
||||
DBUG_RETURN(1); /* purecov: inspected */
|
||||
}
|
||||
if (setup_fields_with_no_wrap(thd, 0, fields, 1, 0, 0))
|
||||
DBUG_RETURN(1); /* purecov: inspected */
|
||||
if (table_list->view && check_fields(thd, fields))
|
||||
{
|
||||
DBUG_RETURN(1);
|
||||
@@ -216,7 +212,7 @@ int mysql_update(THD *thd,
|
||||
table_list->grant.want_privilege= table->grant.want_privilege=
|
||||
(SELECT_ACL & ~table->grant.privilege);
|
||||
#endif
|
||||
if (setup_fields(thd, 0, table_list, values, 1, 0, 0))
|
||||
if (setup_fields(thd, 0, values, 1, 0, 0))
|
||||
{
|
||||
free_underlaid_joins(thd, select_lex);
|
||||
DBUG_RETURN(1); /* purecov: inspected */
|
||||
@@ -557,7 +553,9 @@ bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
|
||||
tables.table= table;
|
||||
tables.alias= table_list->alias;
|
||||
|
||||
if (setup_tables(thd, table_list, conds, &select_lex->leaf_tables, FALSE) ||
|
||||
if (setup_tables(thd, &select_lex->context,
|
||||
table_list, conds, &select_lex->leaf_tables,
|
||||
FALSE) ||
|
||||
setup_conds(thd, table_list, select_lex->leaf_tables, conds) ||
|
||||
select_lex->setup_ref_array(thd, order_num) ||
|
||||
setup_order(thd, select_lex->ref_pointer_array,
|
||||
@@ -617,7 +615,6 @@ bool mysql_multi_update_prepare(THD *thd)
|
||||
TABLE_LIST *tl, *leaves;
|
||||
List<Item> *fields= &lex->select_lex.item_list;
|
||||
table_map tables_for_update;
|
||||
int res;
|
||||
bool update_view= 0;
|
||||
/*
|
||||
if this multi-update was converted from usual update, here is table
|
||||
@@ -642,15 +639,12 @@ bool mysql_multi_update_prepare(THD *thd)
|
||||
call in setup_tables()).
|
||||
*/
|
||||
|
||||
if (setup_tables(thd, table_list, &lex->select_lex.where,
|
||||
if (setup_tables(thd, &lex->select_lex.context,
|
||||
table_list, &lex->select_lex.where,
|
||||
&lex->select_lex.leaf_tables, FALSE))
|
||||
DBUG_RETURN(TRUE);
|
||||
leaves= lex->select_lex.leaf_tables;
|
||||
|
||||
if ((lex->select_lex.no_wrap_view_item= 1,
|
||||
res= setup_fields(thd, 0, table_list, *fields, 1, 0, 0),
|
||||
lex->select_lex.no_wrap_view_item= 0,
|
||||
res))
|
||||
if (setup_fields_with_no_wrap(thd, 0, *fields, 1, 0, 0))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
for (tl= table_list; tl ; tl= tl->next_local)
|
||||
@@ -672,6 +666,7 @@ bool mysql_multi_update_prepare(THD *thd)
|
||||
/*
|
||||
Setup timestamp handling and locking mode
|
||||
*/
|
||||
leaves= lex->select_lex.leaf_tables;
|
||||
for (tl= leaves; tl; tl= tl->next_leaf)
|
||||
{
|
||||
TABLE *table= tl->table;
|
||||
@@ -762,12 +757,10 @@ bool mysql_multi_update_prepare(THD *thd)
|
||||
for (TABLE_LIST *tbl= table_list; tbl; tbl= tbl->next_global)
|
||||
tbl->cleanup_items();
|
||||
|
||||
if (setup_tables(thd, table_list, &lex->select_lex.where,
|
||||
if (setup_tables(thd, &lex->select_lex.context,
|
||||
table_list, &lex->select_lex.where,
|
||||
&lex->select_lex.leaf_tables, FALSE) ||
|
||||
(lex->select_lex.no_wrap_view_item= 1,
|
||||
res= setup_fields(thd, 0, table_list, *fields, 1, 0, 0),
|
||||
lex->select_lex.no_wrap_view_item= 0,
|
||||
res))
|
||||
setup_fields_with_no_wrap(thd, 0, *fields, 1, 0, 0))
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
@@ -897,7 +890,7 @@ int multi_update::prepare(List<Item> ¬_used_values,
|
||||
reference tables
|
||||
*/
|
||||
|
||||
if (setup_fields(thd, 0, all_tables, *values, 1, 0, 0))
|
||||
if (setup_fields(thd, 0, *values, 1, 0, 0))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user