21 #include <drizzled/function/math/decimal_typecast.h>
22 #include <drizzled/error.h>
23 #include <drizzled/session.h>
24 #include <drizzled/internal/m_string.h>
45 class_decimal2double(E_DEC_FATAL_ERROR, tmp, &res);
57 tmp->val_int32(E_DEC_FATAL_ERROR, unsigned_flag, &res);
71 class_decimal_round(E_DEC_FATAL_ERROR, tmp, decimals,
false, dec);
81 precision= class_decimal_length_to_precision(max_length,
82 decimals, unsigned_flag);
83 if (precision - decimals < (uint) class_decimal_intg(dec))
85 max_Decimal(dec, precision, decimals);
92 push_warning_printf(&getSession(), DRIZZLE_ERROR::WARN_LEVEL_ERROR,
93 ER_WARN_DATA_OUT_OF_RANGE,
94 ER(ER_WARN_DATA_OUT_OF_RANGE),
102 char len_buf[20*3 + 1];
105 uint32_t precision= class_decimal_length_to_precision(max_length, decimals,
107 str->append(STRING_WITH_LEN(
"cast("));
109 str->append(STRING_WITH_LEN(
" as decimal("));
111 end=internal::int10_to_str(precision, len_buf,10);
112 str->append(len_buf, (uint32_t) (end - len_buf));
116 end=internal::int10_to_str(decimals, len_buf,10);
117 str->append(len_buf, (uint32_t) (end - len_buf));
virtual void print(String *str)
TODO: Rename this file - func.h is stupid.
String * val_str(String *str)
type::Decimal * val_decimal(type::Decimal *)
int class_decimal2string(const type::Decimal *d, uint32_t fixed_dec, String *str)
Converting decimal to string.
virtual void print(String *str)
virtual type::Decimal * val_decimal(type::Decimal *decimal_buffer)=0