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


Public Member Functions | |
| Item_decimal_typecast (Item *a, int len, int dec) | |
| String * | val_str (String *str) |
| double | val_real () |
| longlong | val_int () |
| my_decimal * | val_decimal (my_decimal *) |
| enum Item_result | result_type () const |
| enum_field_types | field_type () const |
| void | fix_length_and_dec () |
| const char * | func_name () const |
| void | print (String *) |
| bool | check_partition_func_processor (byte *bool_arg) |
Private Attributes | |
| my_decimal | decimal_value |
Definition at line 335 of file item_func.h.
| Item_decimal_typecast::Item_decimal_typecast | ( | Item * | a, | |
| int | len, | |||
| int | dec | |||
| ) | [inline] |
Definition at line 339 of file item_func.h.
References Item::decimals, and Item::max_length.
00339 :Item_func(a) 00340 { 00341 max_length= len + 2; 00342 decimals= dec; 00343 }
| enum_field_types Item_decimal_typecast::field_type | ( | ) | const [inline, virtual] |
Reimplemented from Item.
Definition at line 349 of file item_func.h.
References MYSQL_TYPE_NEWDECIMAL.
00349 { return MYSQL_TYPE_NEWDECIMAL; }
| void Item_decimal_typecast::fix_length_and_dec | ( | ) | [inline, virtual] |
| const char* Item_decimal_typecast::func_name | ( | ) | const [inline, virtual] |
| void Item_decimal_typecast::print | ( | String * | ) | [virtual] |
Reimplemented from Item_func.
Definition at line 988 of file item_func.cc.
References String::append(), Item_func::args, Item::print(), and STRING_WITH_LEN.
00989 { 00990 str->append(STRING_WITH_LEN("cast(")); 00991 args[0]->print(str); 00992 str->append(STRING_WITH_LEN(" as decimal)")); 00993 }
Here is the call graph for this function:

| enum Item_result Item_decimal_typecast::result_type | ( | ) | const [inline, virtual] |
Reimplemented from Item.
Definition at line 348 of file item_func.h.
References DECIMAL_RESULT.
00348 { return DECIMAL_RESULT; }
| my_decimal * Item_decimal_typecast::val_decimal | ( | my_decimal * | ) | [virtual] |
Reimplemented from Item_func.
Definition at line 955 of file item_func.cc.
References Item_func::args, current_thd, Item::decimals, E_DEC_FATAL_ERROR, ER, ER_WARN_DATA_OUT_OF_RANGE, err, FALSE, Item::max_length, max_my_decimal(), my_decimal_intg(), my_decimal_round(), my_decimal_set_zero(), Item::name, NULL, Item::null_value, push_warning_printf(), my_decimal::sign(), Item::unsigned_flag, Item::val_decimal(), and MYSQL_ERROR::WARN_LEVEL_ERROR.
Referenced by val_int(), val_real(), and val_str().
00956 { 00957 my_decimal tmp_buf, *tmp= args[0]->val_decimal(&tmp_buf); 00958 bool sign; 00959 if ((null_value= args[0]->null_value)) 00960 return NULL; 00961 my_decimal_round(E_DEC_FATAL_ERROR, tmp, decimals, FALSE, dec); 00962 sign= dec->sign(); 00963 if (unsigned_flag) 00964 { 00965 if (sign) 00966 { 00967 my_decimal_set_zero(dec); 00968 goto err; 00969 } 00970 } 00971 if (max_length - 2 - decimals < (uint) my_decimal_intg(dec)) 00972 { 00973 max_my_decimal(dec, max_length - 2, decimals); 00974 dec->sign(sign); 00975 goto err; 00976 } 00977 return dec; 00978 00979 err: 00980 push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR, 00981 ER_WARN_DATA_OUT_OF_RANGE, 00982 ER(ER_WARN_DATA_OUT_OF_RANGE), 00983 name, 1); 00984 return dec; 00985 }
Here is the call graph for this function:

Here is the caller graph for this function:

| longlong Item_decimal_typecast::val_int | ( | ) | [virtual] |
Implements Item.
Definition at line 944 of file item_func.cc.
References E_DEC_FATAL_ERROR, my_decimal2int(), Item::null_value, Item::unsigned_flag, and val_decimal().
00945 { 00946 my_decimal tmp_buf, *tmp= val_decimal(&tmp_buf); 00947 longlong res; 00948 if (null_value) 00949 return 0; 00950 my_decimal2int(E_DEC_FATAL_ERROR, tmp, unsigned_flag, &res); 00951 return res; 00952 }
Here is the call graph for this function:

| double Item_decimal_typecast::val_real | ( | ) | [virtual] |
Implements Item.
Definition at line 933 of file item_func.cc.
References E_DEC_FATAL_ERROR, my_decimal2double(), Item::null_value, and val_decimal().
00934 { 00935 my_decimal tmp_buf, *tmp= val_decimal(&tmp_buf); 00936 double res; 00937 if (null_value) 00938 return 0.0; 00939 my_decimal2double(E_DEC_FATAL_ERROR, tmp, &res); 00940 return res; 00941 }
Here is the call graph for this function:

Implements Item.
Definition at line 923 of file item_func.cc.
References E_DEC_FATAL_ERROR, my_decimal2string(), NULL, Item::null_value, and val_decimal().
00924 { 00925 my_decimal tmp_buf, *tmp= val_decimal(&tmp_buf); 00926 if (null_value) 00927 return NULL; 00928 my_decimal2string(E_DEC_FATAL_ERROR, &tmp_buf, 0, 0, 0, str); 00929 return str; 00930 }
Here is the call graph for this function:

Definition at line 337 of file item_func.h.
1.4.7

