do not register changes of stack variable

This commit is contained in:
bell@sanja.is.com.ua 2005-07-03 00:51:02 +03:00
parent 6201504db9
commit 2941da3971
6 changed files with 35 additions and 26 deletions

View File

@ -2837,7 +2837,8 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
reference, reference,
IGNORE_EXCEPT_NON_UNIQUE, IGNORE_EXCEPT_NON_UNIQUE,
!any_privileges && !any_privileges &&
context->check_privileges)) == context->check_privileges,
TRUE)) ==
not_found_field) not_found_field)
{ {
/* /*
@ -2880,7 +2881,8 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
reference, reference,
IGNORE_EXCEPT_NON_UNIQUE, IGNORE_EXCEPT_NON_UNIQUE,
outer_context-> outer_context->
check_privileges)) != check_privileges,
TRUE)) !=
not_found_field) not_found_field)
{ {
if (from_field) if (from_field)
@ -2953,7 +2955,7 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
find_field_in_tables(thd, this, context->table_list, find_field_in_tables(thd, this, context->table_list,
reference, REPORT_ALL_ERRORS, reference, REPORT_ALL_ERRORS,
!any_privileges && !any_privileges &&
context->check_privileges); context->check_privileges, TRUE);
} }
goto error; goto error;
} }
@ -4102,7 +4104,8 @@ bool Item_ref::fix_fields(THD *thd, Item **reference)
outer_context->table_list, outer_context->table_list,
reference, reference,
IGNORE_EXCEPT_NON_UNIQUE, IGNORE_EXCEPT_NON_UNIQUE,
outer_context->check_privileges); outer_context->check_privileges,
TRUE);
if (! from_field) if (! from_field)
goto error; goto error;
if (from_field == view_ref_found) if (from_field == view_ref_found)

View File

@ -758,7 +758,8 @@ enum find_item_error_report_type {REPORT_ALL_ERRORS, REPORT_EXCEPT_NOT_FOUND,
Field *find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables, Field *find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
Item **ref, Item **ref,
find_item_error_report_type report_error, find_item_error_report_type report_error,
bool check_privileges); bool check_privileges,
bool register_tree_change);
Field * Field *
find_field_in_table(THD *thd, TABLE_LIST *table_list, find_field_in_table(THD *thd, TABLE_LIST *table_list,
const char *name, const char *item_name, const char *name, const char *item_name,

View File

@ -688,7 +688,8 @@ db_show_routine_status(THD *thd, int type, const char *wild)
used_field->field_name); used_field->field_name);
if (!field || if (!field ||
!(used_field->field= find_field_in_tables(thd, field, &tables, !(used_field->field= find_field_in_tables(thd, field, &tables,
0, REPORT_ALL_ERRORS, 1))) 0, REPORT_ALL_ERRORS, 1,
TRUE)))
{ {
res= SP_INTERNAL_ERROR; res= SP_INTERNAL_ERROR;
goto err_case1; goto err_case1;

View File

@ -2594,6 +2594,8 @@ Field *find_field_in_real_table(THD *thd, TABLE *table,
except when non-unique fields were found except when non-unique fields were found
- REPORT_ALL_ERRORS - REPORT_ALL_ERRORS
check_privileges need to check privileges check_privileges need to check privileges
register_tree_change TRUE if ref is not stack variable and we
need register changes in item tree
RETURN VALUES RETURN VALUES
0 If error: the found field is not unique, or there are 0 If error: the found field is not unique, or there are
@ -2609,7 +2611,7 @@ Field *find_field_in_real_table(THD *thd, TABLE *table,
Field * Field *
find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables, find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
Item **ref, find_item_error_report_type report_error, Item **ref, find_item_error_report_type report_error,
bool check_privileges) bool check_privileges, bool register_tree_change)
{ {
Field *found=0; Field *found=0;
const char *db=item->db_name; const char *db=item->db_name;
@ -2651,7 +2653,7 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
(test(table->grant.want_privilege) && (test(table->grant.want_privilege) &&
check_privileges), check_privileges),
1, &(item->cached_field_index), 1, &(item->cached_field_index),
TRUE); register_tree_change);
} }
if (found) if (found)
{ {
@ -2707,7 +2709,7 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
(test(tables->grant.want_privilege) && (test(tables->grant.want_privilege) &&
check_privileges), check_privileges),
1, &(item->cached_field_index), 1, &(item->cached_field_index),
TRUE); register_tree_change);
if (find) if (find)
{ {
item->cached_table= tables; item->cached_table= tables;
@ -2775,7 +2777,7 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
check_privileges), check_privileges),
allow_rowid, allow_rowid,
&(item->cached_field_index), &(item->cached_field_index),
TRUE); register_tree_change);
if (field) if (field)
{ {
if (field == WRONG_GRANT) if (field == WRONG_GRANT)

View File

@ -91,7 +91,8 @@ static bool init_fields(THD *thd, TABLE_LIST *tables,
"mysql", find_fields->table_name, "mysql", find_fields->table_name,
find_fields->field_name); find_fields->field_name);
if (!(find_fields->field= find_field_in_tables(thd, field, tables, if (!(find_fields->field= find_field_in_tables(thd, field, tables,
0, REPORT_ALL_ERRORS, 1))) 0, REPORT_ALL_ERRORS, 1,
TRUE)))
DBUG_RETURN(1); DBUG_RETURN(1);
} }
DBUG_RETURN(0); DBUG_RETURN(0);

View File

@ -11890,7 +11890,8 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
order_item_type == Item::REF_ITEM) order_item_type == Item::REF_ITEM)
{ {
from_field= find_field_in_tables(thd, (Item_ident*) order_item, tables, from_field= find_field_in_tables(thd, (Item_ident*) order_item, tables,
&view_ref, IGNORE_ERRORS, TRUE); &view_ref, IGNORE_ERRORS, TRUE,
FALSE);
if(!from_field) if(!from_field)
from_field= (Field*) not_found_field; from_field= (Field*) not_found_field;
} }