summaryrefslogtreecommitdiff
path: root/sql/item_sum.cc
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2003-07-05 03:03:31 +0300
committerunknown <bell@sanja.is.com.ua>2003-07-05 03:03:31 +0300
commit0f792995ec25f26a43c9f34a5f58fbf48e2dadcd (patch)
tree203e283c53d8c9a1e1adedca89bac532a03e81d2 /sql/item_sum.cc
parente25c83e0c6b6db5c5aec223b8f4d18210017181d (diff)
downloadmariadb-git-0f792995ec25f26a43c9f34a5f58fbf48e2dadcd.tar.gz
reduced using of slow current_thd/current_lex macro
initialization of item_thd moved to constructor (in any case we need thd in constructor) initialization of group_concat_max_len to constructor to avoid incorrect length reporting (BUG#757) removed Item_func_group_concat::fix_length_and_dec() because item have its own fix_fields and will not have inherited items mysql-test/r/func_gconcat.result: test for BUG#757 mysql-test/t/func_gconcat.test: test for BUG#757 sql/item_sum.cc: reduced using of slow current_thd/current_lex macro initialization of item_thd moved to constructor (in any case we need thd in constructor) initialization of group_concat_max_len to constructor to avoid incorrect length reporting (BUG#757) sql/item_sum.h: removed Item_func_group_concat::fix_length_and_dec() because item have its own fix_fields and will not have inherited items
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r--sql/item_sum.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 67dffb35724..e16ff6969d3 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1114,7 +1114,7 @@ void Item_sum_count_distinct::make_unique()
bool Item_sum_count_distinct::setup(THD *thd)
{
List<Item> list;
- SELECT_LEX *select_lex= current_lex->current_select->select_lex();
+ SELECT_LEX *select_lex= thd->lex.current_select->select_lex();
if (select_lex->linkage == GLOBAL_OPTIONS_TYPE)
return 1;
@@ -1599,7 +1599,7 @@ Item_func_group_concat::Item_func_group_concat(bool is_distinct,
warning_available(0), key_length(0), rec_offset(0),
tree_mode(0), distinct(is_distinct), warning_for_row(0),
separator(is_separator), tree(&tree_base), table(0),
- order(0), tables_list(0), group_concat_max_len(0),
+ order(0), tables_list(0),
show_elements(0), arg_count_order(0), arg_count_field(0),
arg_show_fields(0), count_cut_values(0)
@@ -1607,8 +1607,11 @@ Item_func_group_concat::Item_func_group_concat(bool is_distinct,
original= 0;
quick_group= 0;
mark_as_sum_func();
- SELECT_LEX *select_lex= current_lex->current_select->select_lex();
+ item_thd= current_thd;
+ SELECT_LEX *select_lex= item_thd->lex.current_select->select_lex();
order= 0;
+ group_concat_max_len= item_thd->variables.group_concat_max_len;
+
arg_show_fields= arg_count_field= is_select->elements;
arg_count_order= is_order ? is_order->elements : 0;
@@ -1773,7 +1776,7 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
}
result_field= 0;
null_value= 1;
- fix_length_and_dec();
+ max_length= group_concat_max_len;
thd->allow_sum_func= 1;
if (!(tmp_table_param= new TMP_TABLE_PARAM))
return 1;
@@ -1786,7 +1789,7 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
bool Item_func_group_concat::setup(THD *thd)
{
List<Item> list;
- SELECT_LEX *select_lex= current_lex->current_select->select_lex();
+ SELECT_LEX *select_lex= thd->lex.current_select->select_lex();
if (select_lex->linkage == GLOBAL_OPTIONS_TYPE)
return 1;
@@ -1873,9 +1876,6 @@ bool Item_func_group_concat::setup(THD *thd)
max_elements_in_tree= ((key_length) ?
thd->variables.max_heap_table_size/key_length : 1);
};
- item_thd= thd;
-
- group_concat_max_len= thd->variables.group_concat_max_len;
/*
Copy table and tree_mode if they belong to this item (if item have not