27
27
Item_decimal::Item_decimal(const char *str_arg, uint32_t length,
28
28
const CHARSET_INFO * const charset)
30
str2my_decimal(E_DEC_FATAL_ERROR, str_arg, length, charset, &decimal_value);
30
str2_class_decimal(E_DEC_FATAL_ERROR, str_arg, length, charset, &decimal_value);
31
31
name= (char*) str_arg;
32
32
decimals= (uint8_t) decimal_value.frac;
38
38
Item_decimal::Item_decimal(int64_t val, bool unsig)
40
int2my_decimal(E_DEC_FATAL_ERROR, val, unsig, &decimal_value);
40
int2_class_decimal(E_DEC_FATAL_ERROR, val, unsig, &decimal_value);
41
41
decimals= (uint8_t) decimal_value.frac;
43
43
max_length= class_decimal_precision_to_length(decimal_value.intg + decimals,
48
48
Item_decimal::Item_decimal(double val, int, int)
50
double2my_decimal(E_DEC_FATAL_ERROR, val, &decimal_value);
50
double2_class_decimal(E_DEC_FATAL_ERROR, val, &decimal_value);
51
51
decimals= (uint8_t) decimal_value.frac;
53
53
max_length= class_decimal_precision_to_length(decimal_value.intg + decimals,
57
57
Item_decimal::Item_decimal(const char *str, const my_decimal *val_arg,
58
58
uint32_t decimal_par, uint32_t length)
60
my_decimal2decimal(val_arg, &decimal_value);
60
class_decimal2decimal(val_arg, &decimal_value);
62
62
decimals= (uint8_t) decimal_par;
63
63
max_length= length;
68
68
Item_decimal::Item_decimal(my_decimal *value_par)
70
my_decimal2decimal(value_par, &decimal_value);
70
class_decimal2decimal(value_par, &decimal_value);
71
71
decimals= (uint8_t) decimal_value.frac;
73
73
max_length= class_decimal_precision_to_length(decimal_value.intg + decimals,
78
78
Item_decimal::Item_decimal(const unsigned char *bin, int precision, int scale)
80
binary2my_decimal(E_DEC_FATAL_ERROR, bin,
80
binary2_class_decimal(E_DEC_FATAL_ERROR, bin,
81
81
&decimal_value, precision, scale);
82
82
decimals= (uint8_t) decimal_value.frac;
88
88
int64_t Item_decimal::val_int()
91
my_decimal2int(E_DEC_FATAL_ERROR, &decimal_value, unsigned_flag, &result);
91
class_decimal2int(E_DEC_FATAL_ERROR, &decimal_value, unsigned_flag, &result);
95
95
double Item_decimal::val_real()
98
my_decimal2double(E_DEC_FATAL_ERROR, &decimal_value, &result);
98
class_decimal2double(E_DEC_FATAL_ERROR, &decimal_value, &result);
102
102
String *Item_decimal::val_str(String *result)
104
104
result->set_charset(&my_charset_bin);
105
my_decimal2string(E_DEC_FATAL_ERROR, &decimal_value, 0, 0, 0, result);
105
class_decimal2string(E_DEC_FATAL_ERROR, &decimal_value, 0, 0, 0, result);
109
109
void Item_decimal::print(String *str, enum_query_type)
111
my_decimal2string(E_DEC_FATAL_ERROR, &decimal_value, 0, 0, 0, &str_value);
111
class_decimal2string(E_DEC_FATAL_ERROR, &decimal_value, 0, 0, 0, &str_value);
112
112
str->append(str_value);
133
133
void Item_decimal::set_decimal_value(my_decimal *value_par)
135
my_decimal2decimal(value_par, &decimal_value);
135
class_decimal2decimal(value_par, &decimal_value);
136
136
decimals= (uint8_t) decimal_value.frac;
137
137
unsigned_flag= !decimal_value.sign();
138
138
max_length= class_decimal_precision_to_length(decimal_value.intg + decimals,