22 #include <drizzled/session.h>
23 #include <drizzled/internal/m_string.h>
24 #include <drizzled/user_var_entry.h>
25 #include <drizzled/type/decimal.h>
26 #include <drizzled/charset.h>
34 if ((*null_value= not value))
40 return *(
double*) value;
43 return (
double) *(int64_t*) value;
48 class_decimal2double(E_DEC_FATAL_ERROR, (
type::Decimal *)value, &result);
53 return internal::my_atof(value);
67 if ((*null_value= not value))
73 return (int64_t) *(
double*) value;
76 return *(int64_t*) value;
81 ((
type::Decimal *)(value))->val_int32(E_DEC_FATAL_ERROR, 0, &result);
88 return internal::my_strtoll10(value, (
char**) 0, &error);
105 if ((*null_value= not value))
111 str->set_real(*(
double*) value, decimals, &my_charset_bin);
116 str->set(*(int64_t*) value, &my_charset_bin);
118 str->set(*(uint64_t*) value, &my_charset_bin);
126 str->copy(value, length, collation.collation);
141 if ((*null_value= not value))
147 double2_class_decimal(E_DEC_FATAL_ERROR, *(
double*) value, val);
151 int2_class_decimal(E_DEC_FATAL_ERROR, *(int64_t*) value, 0, val);
159 val->
store(E_DEC_FATAL_ERROR, value, length, collation.collation);
196 assert(length && size);
205 size_t needed_size= data.size() + ((arg_type == STRING_RESULT) ? 1 : 0);
207 if (needed_size > size)
209 value= (
char *)realloc(value, needed_size);
213 if (arg_type == STRING_RESULT)
214 value[data.size()]= 0;
216 memcpy(value, data.data(), data.size());
217 if (arg_type == DECIMAL_RESULT)
220 collation.set(cs, dv);
221 unsigned_flag= unsigned_arg;
double val_real(bool *null_value) const
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.
void update_hash(bool set_null, data_ref, Item_result type, const charset_info_st *cs, Derivation dv, bool unsigned_arg)
int class_decimal2string(const type::Decimal *d, uint32_t fixed_dec, String *str)
Converting decimal to string.
String * val_str(bool *null_value, String *, uint32_t decimals) const
type::Decimal * val_decimal(bool *null_value, type::Decimal *result) const
int64_t val_int(bool *null_value) const