diff options
author | Igor Babaev <igor@askmonty.org> | 2011-06-04 19:56:06 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2011-06-04 19:56:06 -0700 |
commit | f03a3ee54fb8b5aeeba590677f48b54a57ab45cf (patch) | |
tree | afb1235c5417019a563b1c1d64443f3b890d05df /sql/item_func.cc | |
parent | f0f2ec3086000a22e83ce9ca33d59a3347784e0c (diff) | |
parent | 35c35858f859f23c23a414cdb21fdfe39d5de11c (diff) | |
download | mariadb-git-f03a3ee54fb8b5aeeba590677f48b54a57ab45cf.tar.gz |
Merged the code of mwl 106 into the latest 5.3 with mwl 90 pushed.
Resolved all conflicts and failures.
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r-- | sql/item_func.cc | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index fb4bca2f671..dc21f8711fb 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -202,7 +202,6 @@ Item_func::fix_fields(THD *thd, Item **ref) with_sum_func= with_sum_func || item->with_sum_func; with_field= with_field || item->with_field; used_tables_cache|= item->used_tables(); - not_null_tables_cache|= item->not_null_tables(); const_item_cache&= item->const_item(); with_subselect|= item->with_subselect; } @@ -231,6 +230,21 @@ Item_func::quick_fix_field() } +bool +Item_func::eval_not_null_tables(uchar *opt_arg) +{ + Item **arg,**arg_end; + if (arg_count) + { + for (arg=args, arg_end=args+arg_count; arg != arg_end ; arg++) + { + not_null_tables_cache|= (*arg)->not_null_tables(); + } + } + return FALSE; +} + + void Item_func::fix_after_pullout(st_select_lex *new_parent, Item **ref) { Item **arg,**arg_end; @@ -3984,6 +3998,21 @@ bool Item_func_set_user_var::fix_fields(THD *thd, Item **ref) entry->collation.set(args[0]->collation.collation, DERIVATION_IMPLICIT); collation.set(entry->collation.collation, DERIVATION_IMPLICIT); cached_result_type= args[0]->result_type(); + if (thd->lex->current_select) + { + /* + When this function is used in a derived table/view force the derived + table to be materialized to preserve possible side-effect of setting a + user variable. + */ + SELECT_LEX_UNIT *unit= thd->lex->current_select->master_unit(); + TABLE_LIST *derived; + for (derived= unit->derived; + derived; + derived= derived->select_lex->master_unit()->derived) + derived->set_materialized_derived(); + } + return FALSE; } |