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());
TODO: Rename this file - func.h is stupid.
String * val_str(String *str)
type::Decimal * val_decimal(type::Decimal *)
int store(uint32_t mask, const char *from, uint32_t length, const charset_info_st *charset)
Convert string for decimal when string can be in some multibyte charset.
virtual double real_op()=0
Performs the operation that this functions implements when the result type is REAL.
virtual type::Decimal * decimal_op(type::Decimal *)=0
Performs the operation that this functions implements when the result type is DECIMAL.
virtual String * str_op(String *)=0
Performs the operation that this functions implements when the result type is a string type...
int class_decimal2string(const type::Decimal *d, uint32_t fixed_dec, String *str)
Converting decimal to string.
virtual int64_t int_op()=0
Performs the operation that this functions implements when the result type is INT.