#include <item_sum.h>
Inheritance diagram for Item_avg_field:


Public Member Functions | |
| Item_avg_field (Item_result res_type, Item_sum_avg *item) | |
| enum Type | type () const |
| double | val_real () |
| longlong | val_int () |
| my_decimal * | val_decimal (my_decimal *) |
| bool | is_null () |
| String * | val_str (String *) |
| enum_field_types | field_type () const |
| void | fix_length_and_dec () |
| enum Item_result | result_type () const |
Public Attributes | |
| Field * | field |
| Item_result | hybrid_type |
| uint | f_precision |
| uint | f_scale |
| uint | dec_bin_size |
| uint | prec_increment |
Definition at line 560 of file item_sum.h.
| Item_avg_field::Item_avg_field | ( | Item_result | res_type, | |
| Item_sum_avg * | item | |||
| ) |
Definition at line 2211 of file item_sum.cc.
References Item_sum_avg::dec_bin_size, dec_bin_size, DECIMAL_RESULT, Item::decimals, Item_sum_avg::f_precision, f_precision, Item_sum_avg::f_scale, f_scale, field, hybrid_type, Item::max_length, Item::maybe_null, Item::name, Item_sum_avg::prec_increment, prec_increment, Item_result_field::result_field, and Item::unsigned_flag.
02212 { 02213 name=item->name; 02214 decimals=item->decimals; 02215 max_length= item->max_length; 02216 unsigned_flag= item->unsigned_flag; 02217 field=item->result_field; 02218 maybe_null=1; 02219 hybrid_type= res_type; 02220 prec_increment= item->prec_increment; 02221 if (hybrid_type == DECIMAL_RESULT) 02222 { 02223 f_scale= item->f_scale; 02224 f_precision= item->f_precision; 02225 dec_bin_size= item->dec_bin_size; 02226 } 02227 }
| enum_field_types Item_avg_field::field_type | ( | ) | const [inline, virtual] |
Reimplemented from Item.
Definition at line 574 of file item_sum.h.
References DECIMAL_RESULT, hybrid_type, MYSQL_TYPE_DOUBLE, and MYSQL_TYPE_NEWDECIMAL.
00575 { 00576 return hybrid_type == DECIMAL_RESULT ? 00577 MYSQL_TYPE_NEWDECIMAL : MYSQL_TYPE_DOUBLE; 00578 }
| void Item_avg_field::fix_length_and_dec | ( | ) | [inline, virtual] |
| bool Item_avg_field::is_null | ( | ) | [inline, virtual] |
Reimplemented from Item.
Definition at line 572 of file item_sum.h.
References Item::null_value, and val_int().
00572 { (void) val_int(); return null_value; }
Here is the call graph for this function:

| enum Item_result Item_avg_field::result_type | ( | ) | const [inline, virtual] |
Reimplemented from Item.
Definition at line 580 of file item_sum.h.
References hybrid_type.
00580 { return hybrid_type; }
| enum Type Item_avg_field::type | ( | ) | const [inline, virtual] |
Implements Item.
Definition at line 568 of file item_sum.h.
References Item::FIELD_AVG_ITEM.
00568 { return FIELD_AVG_ITEM; }
| my_decimal * Item_avg_field::val_decimal | ( | my_decimal * | ) | [virtual] |
Implements Item.
Definition at line 2255 of file item_sum.cc.
References binary2my_decimal(), count, dec_bin_size, E_DEC_FATAL_ERROR, f_precision, f_scale, field, hybrid_type, int2my_decimal(), my_decimal_div(), Item::null_value, prec_increment, Field::ptr, REAL_RESULT, sint8korr, and Item::val_decimal_from_real().
02256 { 02257 // fix_fields() never calls for this Item 02258 if (hybrid_type == REAL_RESULT) 02259 return val_decimal_from_real(dec_buf); 02260 02261 longlong count= sint8korr(field->ptr + dec_bin_size); 02262 if ((null_value= !count)) 02263 return 0; 02264 02265 my_decimal dec_count, dec_field; 02266 binary2my_decimal(E_DEC_FATAL_ERROR, 02267 field->ptr, &dec_field, f_precision, f_scale); 02268 int2my_decimal(E_DEC_FATAL_ERROR, count, 0, &dec_count); 02269 my_decimal_div(E_DEC_FATAL_ERROR, dec_buf, 02270 &dec_field, &dec_count, prec_increment); 02271 return dec_buf; 02272 }
Here is the call graph for this function:

| longlong Item_avg_field::val_int | ( | ) | [virtual] |
Implements Item.
Definition at line 2249 of file item_sum.cc.
References rint, and val_real().
Referenced by is_null().
Here is the call graph for this function:

Here is the caller graph for this function:

| double Item_avg_field::val_real | ( | ) | [virtual] |
Implements Item.
Definition at line 2229 of file item_sum.cc.
References count, DECIMAL_RESULT, field, float8get, hybrid_type, Item::null_value, Field::ptr, sint8korr, and Item::val_real_from_decimal().
Referenced by val_int().
02230 { 02231 // fix_fields() never calls for this Item 02232 double nr; 02233 longlong count; 02234 char *res; 02235 02236 if (hybrid_type == DECIMAL_RESULT) 02237 return val_real_from_decimal(); 02238 02239 float8get(nr,field->ptr); 02240 res= (field->ptr+sizeof(double)); 02241 count= sint8korr(res); 02242 02243 if ((null_value= !count)) 02244 return 0.0; 02245 return nr/(double) count; 02246 }
Here is the call graph for this function:

Here is the caller graph for this function:

Implements Item.
Definition at line 2275 of file item_sum.cc.
References DECIMAL_RESULT, hybrid_type, Item::val_string_from_decimal(), and Item::val_string_from_real().
02276 { 02277 // fix_fields() never calls for this Item 02278 if (hybrid_type == DECIMAL_RESULT) 02279 return val_string_from_decimal(str); 02280 return val_string_from_real(str); 02281 }
Here is the call graph for this function:

Definition at line 563 of file item_sum.h.
Referenced by Item_avg_field(), val_decimal(), and val_real().
Definition at line 564 of file item_sum.h.
Referenced by field_type(), Item_avg_field(), result_type(), val_decimal(), val_real(), and val_str().
1.4.7

