#include <item_func.h>
Inheritance diagram for Item_func_numhybrid:


Public Member Functions | |
| Item_func_numhybrid (Item *a) | |
| Item_func_numhybrid (Item *a, Item *b) | |
| Item_func_numhybrid (List< Item > &list) | |
| enum Item_result | result_type () const |
| void | fix_length_and_dec () |
| void | fix_num_length_and_dec () |
| virtual void | find_num_type ()=0 |
| double | val_real () |
| longlong | val_int () |
| my_decimal * | val_decimal (my_decimal *) |
| String * | val_str (String *str) |
| virtual longlong | int_op ()=0 |
| virtual double | real_op ()=0 |
| virtual my_decimal * | decimal_op (my_decimal *)=0 |
| virtual String * | str_op (String *)=0 |
| bool | is_null () |
Protected Attributes | |
| Item_result | hybrid_type |
Definition at line 214 of file item_func.h.
| Item_func_numhybrid::Item_func_numhybrid | ( | Item * | a | ) | [inline] |
Definition at line 224 of file item_func.h.
00225 :Item_func(list), hybrid_type(REAL_RESULT) 00226 {}
| virtual my_decimal* Item_func_numhybrid::decimal_op | ( | my_decimal * | ) | [pure virtual] |
Implemented in Item_func_coalesce, Item_func_ifnull, Item_func_plus, Item_func_minus, Item_func_mul, Item_func_div, Item_func_mod, Item_func_neg, Item_func_abs, Item_func_ceiling, Item_func_floor, and Item_func_round.
Referenced by val_decimal(), val_int(), val_real(), and val_str().
Here is the caller graph for this function:

| virtual void Item_func_numhybrid::find_num_type | ( | ) | [pure virtual] |
Implemented in Item_func_coalesce, Item_func_num1, Item_num_op, and Item_func_int_val.
Referenced by fix_length_and_dec().
Here is the caller graph for this function:

| void Item_func_numhybrid::fix_length_and_dec | ( | ) | [virtual] |
Implements Item_result_field.
Reimplemented in Item_func_coalesce, Item_func_ifnull, Item_func_minus, Item_func_div, Item_func_neg, Item_func_abs, and Item_func_round.
Definition at line 682 of file item_func.cc.
References find_num_type(), and fix_num_length_and_dec().
Referenced by Item_func_abs::fix_length_and_dec(), Item_func_neg::fix_length_and_dec(), Item_func_div::fix_length_and_dec(), and Item_func_minus::fix_length_and_dec().
00683 { 00684 fix_num_length_and_dec(); 00685 find_num_type(); 00686 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void Item_func_numhybrid::fix_num_length_and_dec | ( | ) | [virtual] |
Reimplemented from Item_func.
Reimplemented in Item_func_num1, Item_func_neg, and Item_func_int_val.
Definition at line 459 of file item_func.cc.
Referenced by fix_length_and_dec().
Here is the caller graph for this function:

| virtual longlong Item_func_numhybrid::int_op | ( | ) | [pure virtual] |
Implemented in Item_func_coalesce, Item_func_ifnull, Item_func_plus, Item_func_minus, Item_func_mul, Item_func_div, Item_func_mod, Item_func_neg, Item_func_abs, Item_func_ceiling, Item_func_floor, and Item_func_round.
Referenced by val_decimal(), val_int(), val_real(), and val_str().
Here is the caller graph for this function:

| bool Item_func_numhybrid::is_null | ( | ) | [inline, virtual] |
Reimplemented from Item_func.
Definition at line 242 of file item_func.h.
References Item::null_value, and val_real().
00242 { (void) val_real(); return null_value; }
Here is the call graph for this function:

| virtual double Item_func_numhybrid::real_op | ( | ) | [pure virtual] |
Implemented in Item_func_coalesce, Item_func_ifnull, Item_func_plus, Item_func_minus, Item_func_mul, Item_func_div, Item_func_mod, Item_func_neg, Item_func_abs, Item_func_ceiling, Item_func_floor, and Item_func_round.
Referenced by val_decimal(), val_int(), val_real(), and val_str().
Here is the caller graph for this function:

| enum Item_result Item_func_numhybrid::result_type | ( | ) | const [inline, virtual] |
Reimplemented from Item.
Reimplemented in Item_func_coalesce.
Definition at line 228 of file item_func.h.
References hybrid_type.
Referenced by Item_func_int_val::find_num_type(), Item_func_num1::find_num_type(), Item_func_round::fix_length_and_dec(), Item_func_floor::int_op(), Item_func_ceiling::int_op(), Item_func_div::result_precision(), Item_func_mul::result_precision(), and Item_func_additive_op::result_precision().
00228 { return hybrid_type; }
Here is the caller graph for this function:

Implemented in Item_func_coalesce, Item_func_ifnull, Item_func_num1, and Item_num_op.
Referenced by val_decimal(), val_int(), val_real(), and val_str().
Here is the caller graph for this function:

| my_decimal * Item_func_numhybrid::val_decimal | ( | my_decimal * | ) | [virtual] |
Reimplemented from Item_func.
Definition at line 794 of file item_func.cc.
References String::charset(), DBUG_ASSERT, decimal_op(), DECIMAL_RESULT, double2my_decimal(), E_DEC_FATAL_ERROR, Item::fixed, hybrid_type, int2my_decimal(), int_op(), INT_RESULT, String::length(), NULL, String::ptr(), real_op(), REAL_RESULT, ROW_RESULT, str2my_decimal(), str_op(), Item::str_value, STRING_RESULT, and Item::unsigned_flag.
Referenced by Item_func_coalesce::decimal_op().
00795 { 00796 my_decimal *val= decimal_value; 00797 DBUG_ASSERT(fixed == 1); 00798 switch (hybrid_type) { 00799 case DECIMAL_RESULT: 00800 val= decimal_op(decimal_value); 00801 break; 00802 case INT_RESULT: 00803 { 00804 longlong result= int_op(); 00805 int2my_decimal(E_DEC_FATAL_ERROR, result, unsigned_flag, decimal_value); 00806 break; 00807 } 00808 case REAL_RESULT: 00809 { 00810 double result= (double)real_op(); 00811 double2my_decimal(E_DEC_FATAL_ERROR, result, decimal_value); 00812 break; 00813 } 00814 case STRING_RESULT: 00815 { 00816 String *res; 00817 if (!(res= str_op(&str_value))) 00818 return NULL; 00819 00820 str2my_decimal(E_DEC_FATAL_ERROR, (char*) res->ptr(), 00821 res->length(), res->charset(), decimal_value); 00822 break; 00823 } 00824 case ROW_RESULT: 00825 default: 00826 DBUG_ASSERT(0); 00827 } 00828 return val; 00829 }
Here is the call graph for this function:

Here is the caller graph for this function:

| longlong Item_func_numhybrid::val_int | ( | ) | [virtual] |
Implements Item.
Definition at line 759 of file item_func.cc.
References String::charset(), charset_info_st::cset, DBUG_ASSERT, decimal_op(), DECIMAL_RESULT, E_DEC_FATAL_ERROR, Item::fixed, hybrid_type, int_op(), INT_RESULT, String::length(), my_decimal2int(), String::ptr(), real_op(), REAL_RESULT, rint, str_op(), Item::str_value, STRING_RESULT, my_charset_handler_st::strtoll10, and Item::unsigned_flag.
Referenced by Item_func_round::decimal_op(), Item_func_round::fix_length_and_dec(), Item_func_neg::fix_length_and_dec(), Item_func_round::int_op(), Item_func_coalesce::int_op(), and Item_func_round::real_op().
00760 { 00761 DBUG_ASSERT(fixed == 1); 00762 switch (hybrid_type) { 00763 case DECIMAL_RESULT: 00764 { 00765 my_decimal decimal_value, *val; 00766 if (!(val= decimal_op(&decimal_value))) 00767 return 0; // null is set 00768 longlong result; 00769 my_decimal2int(E_DEC_FATAL_ERROR, val, unsigned_flag, &result); 00770 return result; 00771 } 00772 case INT_RESULT: 00773 return int_op(); 00774 case REAL_RESULT: 00775 return (longlong) rint(real_op()); 00776 case STRING_RESULT: 00777 { 00778 int err_not_used; 00779 String *res; 00780 if (!(res= str_op(&str_value))) 00781 return 0; 00782 00783 char *end= (char*) res->ptr() + res->length(); 00784 CHARSET_INFO *cs= str_value.charset(); 00785 return (*(cs->cset->strtoll10))(cs, res->ptr(), &end, &err_not_used); 00786 } 00787 default: 00788 DBUG_ASSERT(0); 00789 } 00790 return 0; 00791 }
Here is the call graph for this function:

Here is the caller graph for this function:

| double Item_func_numhybrid::val_real | ( | ) | [virtual] |
Implements Item.
Definition at line 727 of file item_func.cc.
References String::charset(), DBUG_ASSERT, decimal_op(), DECIMAL_RESULT, E_DEC_FATAL_ERROR, Item::fixed, hybrid_type, int_op(), INT_RESULT, String::length(), my_decimal2double(), my_strntod, String::ptr(), real_op(), REAL_RESULT, str_op(), Item::str_value, and STRING_RESULT.
Referenced by is_null(), and Item_func_coalesce::real_op().
00728 { 00729 DBUG_ASSERT(fixed == 1); 00730 switch (hybrid_type) { 00731 case DECIMAL_RESULT: 00732 { 00733 my_decimal decimal_value, *val; 00734 double result; 00735 if (!(val= decimal_op(&decimal_value))) 00736 return 0.0; // null is set 00737 my_decimal2double(E_DEC_FATAL_ERROR, val, &result); 00738 return result; 00739 } 00740 case INT_RESULT: 00741 return (double)int_op(); 00742 case REAL_RESULT: 00743 return real_op(); 00744 case STRING_RESULT: 00745 { 00746 char *end_not_used; 00747 int err_not_used; 00748 String *res= str_op(&str_value); 00749 return (res ? my_strntod(res->charset(), (char*) res->ptr(), res->length(), 00750 &end_not_used, &err_not_used) : 0.0); 00751 } 00752 default: 00753 DBUG_ASSERT(0); 00754 } 00755 return 0.0; 00756 }
Here is the call graph for this function:

Here is the caller graph for this function:

Implements Item.
Definition at line 689 of file item_func.cc.
References DBUG_ASSERT, decimal_op(), DECIMAL_RESULT, Item::decimals, E_DEC_FATAL_ERROR, FALSE, Item::fixed, hybrid_type, int_op(), INT_RESULT, my_charset_bin, my_decimal2string(), my_decimal_round(), Item::null_value, real_op(), REAL_RESULT, String::set_int(), String::set_real(), str_op(), Item::str_value, STRING_RESULT, and Item::unsigned_flag.
Referenced by Item_func_coalesce::str_op().
00690 { 00691 DBUG_ASSERT(fixed == 1); 00692 switch (hybrid_type) { 00693 case DECIMAL_RESULT: 00694 { 00695 my_decimal decimal_value, *val; 00696 if (!(val= decimal_op(&decimal_value))) 00697 return 0; // null is set 00698 my_decimal_round(E_DEC_FATAL_ERROR, val, decimals, FALSE, val); 00699 my_decimal2string(E_DEC_FATAL_ERROR, val, 0, 0, 0, str); 00700 break; 00701 } 00702 case INT_RESULT: 00703 { 00704 longlong nr= int_op(); 00705 if (null_value) 00706 return 0; /* purecov: inspected */ 00707 str->set_int(nr, unsigned_flag, &my_charset_bin); 00708 break; 00709 } 00710 case REAL_RESULT: 00711 { 00712 double nr= real_op(); 00713 if (null_value) 00714 return 0; /* purecov: inspected */ 00715 str->set_real(nr,decimals,&my_charset_bin); 00716 break; 00717 } 00718 case STRING_RESULT: 00719 return str_op(&str_value); 00720 default: 00721 DBUG_ASSERT(0); 00722 } 00723 return str; 00724 }
Here is the call graph for this function:

Here is the caller graph for this function:

Item_result Item_func_numhybrid::hybrid_type [protected] |
Definition at line 217 of file item_func.h.
Referenced by Item_func_int_val::find_num_type(), Item_func_num1::find_num_type(), Item_num_op::find_num_type(), Item_func_round::fix_length_and_dec(), Item_func_neg::fix_length_and_dec(), Item_func_div::fix_length_and_dec(), Item_func_coalesce::fix_length_and_dec(), Item_func_ifnull::fix_length_and_dec(), result_type(), Item_func_coalesce::result_type(), val_decimal(), val_int(), val_real(), and val_str().
1.4.7

