#include "mysql_priv.h"#include "sql_select.h"Include dependency graph for item_sum.cc:

Go to the source code of this file.
Classes | |
| struct | Hybrid_type_traits_fast_decimal |
Functions | |
| static C_MODE_START int | simple_raw_key_cmp (void *arg, const void *key1, const void *key2) |
| static int | item_sum_distinct_walk (void *element, element_count num_of_dups, void *item) |
| int | simple_str_key_cmp (void *arg, byte *key1, byte *key2) |
| int | composite_key_cmp (void *arg, byte *key1, byte *key2) |
| static C_MODE_START int | count_distinct_walk (void *elem, element_count count, void *arg) |
| int | group_concat_key_cmp_with_distinct (void *arg, byte *key1, byte *key2) |
| int | group_concat_key_cmp_with_order (void *arg, byte *key1, byte *key2) |
| int | group_concat_key_cmp_with_distinct_and_order (void *arg, byte *key1, byte *key2) |
| int | dump_leaf_key (byte *key, element_count count __attribute__((unused)), Item_func_group_concat *item) |
Variables | |
| static const Hybrid_type_traits_fast_decimal | fast_decimal_traits_instance |
Definition at line 2431 of file item_sum.cc.
References f, st_table::field, Item_sum_count_distinct::field_lengths, st_table_share::fields, lengths, st_table::s, and Item_sum_count_distinct::table.
02432 { 02433 Item_sum_count_distinct* item = (Item_sum_count_distinct*)arg; 02434 Field **field = item->table->field; 02435 Field **field_end= field + item->table->s->fields; 02436 uint32 *lengths=item->field_lengths; 02437 for (; field < field_end; ++field) 02438 { 02439 Field* f = *field; 02440 int len = *lengths++; 02441 int res = f->cmp((char *) key1, (char *) key2); 02442 if (res) 02443 return res; 02444 key1 += len; 02445 key2 += len; 02446 } 02447 return 0; 02448 }
| static C_MODE_START int count_distinct_walk | ( | void * | elem, | |
| element_count | count, | |||
| void * | arg | |||
| ) | [static] |
Definition at line 2453 of file item_sum.cc.
Referenced by Item_sum_count_distinct::val_int().
02454 { 02455 (*((ulonglong*)arg))++; 02456 return 0; 02457 }
Here is the caller graph for this function:

| int dump_leaf_key | ( | byte * | key, | |
| element_count count | __attribute__((unused)), | |||
| Item_func_group_concat * | item | |||
| ) |
Definition at line 2982 of file item_sum.cc.
References String::append(), Item_func_group_concat::arg_count_field, Item_sum::args, Item_func_group_concat::count_cut_values, DBUG_ASSERT, default_charset_info, FALSE, String::length(), Item::max_length, Item_func_group_concat::no_appended, st_table_share::null_bytes, offset, st_table_share::reclength, st_table::record, Item_func_group_concat::result, st_table::s, Item_func_group_concat::separator, Item_func_group_concat::table, TRUE, and Item_func_group_concat::warning_for_row.
02984 { 02985 TABLE *table= item->table; 02986 String tmp((char *)table->record[1], table->s->reclength, 02987 default_charset_info); 02988 String tmp2; 02989 String *result= &item->result; 02990 Item **arg= item->args, **arg_end= item->args + item->arg_count_field; 02991 02992 if (item->no_appended) 02993 item->no_appended= FALSE; 02994 else 02995 result->append(*item->separator); 02996 02997 tmp.length(0); 02998 02999 for (; arg < arg_end; arg++) 03000 { 03001 String *res; 03002 if (! (*arg)->const_item()) 03003 { 03004 /* 03005 We have to use get_tmp_table_field() instead of 03006 real_item()->get_tmp_table_field() because we want the field in 03007 the temporary table, not the original field 03008 We also can't use table->field array to access the fields 03009 because it contains both order and arg list fields. 03010 */ 03011 Field *field= (*arg)->get_tmp_table_field(); 03012 uint offset= field->offset() - table->s->null_bytes; 03013 DBUG_ASSERT(offset < table->s->reclength); 03014 res= field->val_str(&tmp, (char *) key + offset); 03015 } 03016 else 03017 res= (*arg)->val_str(&tmp); 03018 if (res) 03019 result->append(*res); 03020 } 03021 03022 /* stop if length of result more than max_length */ 03023 if (result->length() > item->max_length) 03024 { 03025 item->count_cut_values++; 03026 result->length(item->max_length); 03027 item->warning_for_row= TRUE; 03028 return 1; 03029 } 03030 return 0; 03031 }
Here is the call graph for this function:

Definition at line 2883 of file item_sum.cc.
References Item_func_group_concat::arg_count_field, Item_sum::args, Field::cmp(), st_table_share::null_bytes, Field::offset(), offset, st_table::s, and Item_func_group_concat::table.
Referenced by group_concat_key_cmp_with_distinct_and_order().
02885 { 02886 Item_func_group_concat* grp_item= (Item_func_group_concat*)arg; 02887 TABLE *table= grp_item->table; 02888 Item **field_item, **end; 02889 02890 for (field_item= grp_item->args, end= field_item + grp_item->arg_count_field; 02891 field_item < end; 02892 field_item++) 02893 { 02894 /* 02895 We have to use get_tmp_table_field() instead of 02896 real_item()->get_tmp_table_field() because we want the field in 02897 the temporary table, not the original field 02898 */ 02899 Field *field= (*field_item)->get_tmp_table_field(); 02900 /* 02901 If field_item is a const item then either get_tp_table_field returns 0 02902 or it is an item over a const table. 02903 */ 02904 if (field && !(*field_item)->const_item()) 02905 { 02906 int res; 02907 uint offset= field->offset() - table->s->null_bytes; 02908 if ((res= field->cmp((char *) key1 + offset, (char *) key2 + offset))) 02909 return res; 02910 } 02911 } 02912 return 0; 02913 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2969 of file item_sum.cc.
References group_concat_key_cmp_with_distinct(), and group_concat_key_cmp_with_order().
02971 { 02972 if (!group_concat_key_cmp_with_distinct(arg,key1,key2)) 02973 return 0; 02974 return(group_concat_key_cmp_with_order(arg,key1,key2)); 02975 }
Here is the call graph for this function:

Definition at line 2921 of file item_sum.cc.
References Item_func_group_concat::arg_count_order, Field::cmp(), Item::const_item(), Item::get_tmp_table_field(), st_table_share::null_bytes, Field::offset(), offset, Item_func_group_concat::order, st_table::s, and Item_func_group_concat::table.
Referenced by group_concat_key_cmp_with_distinct_and_order().
02922 { 02923 Item_func_group_concat* grp_item= (Item_func_group_concat*) arg; 02924 ORDER **order_item, **end; 02925 TABLE *table= grp_item->table; 02926 02927 for (order_item= grp_item->order, end=order_item+ grp_item->arg_count_order; 02928 order_item < end; 02929 order_item++) 02930 { 02931 Item *item= *(*order_item)->item; 02932 /* 02933 We have to use get_tmp_table_field() instead of 02934 real_item()->get_tmp_table_field() because we want the field in 02935 the temporary table, not the original field 02936 */ 02937 Field *field= item->get_tmp_table_field(); 02938 /* 02939 If item is a const item then either get_tp_table_field returns 0 02940 or it is an item over a const table. 02941 */ 02942 if (field && !item->const_item()) 02943 { 02944 int res; 02945 uint offset= field->offset() - table->s->null_bytes; 02946 if ((res= field->cmp((char *) key1 + offset, (char *) key2 + offset))) 02947 return (*order_item)->asc ? res : -res; 02948 } 02949 } 02950 /* 02951 We can't return 0 because in that case the tree class would remove this 02952 item as double value. This would cause problems for case-changes and 02953 if the returned values are not the same we do the sort on. 02954 */ 02955 return 1; 02956 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static int item_sum_distinct_walk | ( | void * | element, | |
| element_count | num_of_dups, | |||
| void * | item | |||
| ) | [static] |
Definition at line 737 of file item_sum.cc.
Referenced by Item_sum_distinct::calculate_val_and_count().
00739 { 00740 return ((Item_sum_distinct*) (item))->unique_walk_function(element); 00741 }
Here is the caller graph for this function:

| static C_MODE_START int simple_raw_key_cmp | ( | void * | arg, | |
| const void * | key1, | |||
| const void * | key2 | |||
| ) | [static] |
Definition at line 731 of file item_sum.cc.
References memcmp().
Referenced by Item_sum_count_distinct::setup(), and Item_sum_distinct::setup().
Here is the call graph for this function:

Here is the caller graph for this function:

const Hybrid_type_traits_fast_decimal fast_decimal_traits_instance [static] |
Definition at line 793 of file item_sum.cc.
Referenced by Hybrid_type_traits_fast_decimal::instance().
1.4.7

