22 #include <drizzled/function/numhybrid.h>
27 void Item_func_numhybrid::fix_num_length_and_dec()
30 void Item_func_numhybrid::fix_length_and_dec()
32 fix_num_length_and_dec();
39 switch (hybrid_type) {
45 class_decimal_round(E_DEC_FATAL_ERROR, val, decimals,
false, val);
54 str->set_int(nr, unsigned_flag, &my_charset_bin);
62 str->set_real(nr,decimals,&my_charset_bin);
77 switch (hybrid_type) {
84 class_decimal2double(E_DEC_FATAL_ERROR, val, &result);
90 return unsigned_flag ? (double) ((uint64_t) result) : (
double) result;
99 return (res ? my_strntod(res->charset(), (
char*) res->ptr(), res->length(),
100 &end_not_used, &err_not_used) : 0.0);
113 switch (hybrid_type) {
120 val->val_int32(E_DEC_FATAL_ERROR, unsigned_flag, &result);
126 return (int64_t) rint(
real_op());
134 char *end= (
char*) res->ptr() + res->length();
136 return (*(cs->cset->strtoll10))(cs, res->ptr(), &end, &err_not_used);
150 switch (hybrid_type) {
157 int2_class_decimal(E_DEC_FATAL_ERROR, result, unsigned_flag, decimal_value);
162 double result= (double)
real_op();
163 double2_class_decimal(E_DEC_FATAL_ERROR, result, decimal_value);
172 decimal_value->
store(E_DEC_FATAL_ERROR, (
char*) res->ptr(),
173 res->length(), res->charset());