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;