22
#include <drizzled/server_includes.h>
23
23
#include <drizzled/field/num.h>
24
24
#include <drizzled/error.h>
25
25
#include <drizzled/table.h>
26
26
#include <drizzled/session.h>
27
#include "drizzled/internal/my_sys.h"
33
29
Numeric fields base class constructor.
35
Field_num::Field_num(unsigned char *ptr_arg,
37
unsigned char *null_ptr_arg,
38
unsigned char null_bit_arg,
39
utype unireg_check_arg,
31
Field_num::Field_num(unsigned char *ptr_arg,uint32_t len_arg, unsigned char *null_ptr_arg,
32
unsigned char null_bit_arg, utype unireg_check_arg,
40
33
const char *field_name_arg,
51
decimal_precision(zero_arg),
52
unsigned_flag(unsigned_arg)
34
uint8_t dec_arg, bool zero_arg, bool unsigned_arg)
35
:Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
36
unireg_check_arg, field_name_arg),
37
dec(dec_arg),decimal_precision(zero_arg), unsigned_flag(unsigned_arg)
86
71
String tmp(buff, (uint32_t) sizeof(buff), system_charset_info);
87
72
tmp.copy(str, length, system_charset_info);
88
push_warning_printf(getTable()->in_use, DRIZZLE_ERROR::WARN_LEVEL_WARN,
73
push_warning_printf(table->in_use, DRIZZLE_ERROR::WARN_LEVEL_WARN,
89
74
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
90
75
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
91
76
"integer", tmp.c_ptr(), field_name,
92
(uint32_t) getTable()->in_use->row_count);
77
(uint32_t) table->in_use->row_count);
95
80
/* Test if we have garbage at the end of the given string. */
143
128
goto out_of_range;
146
if (getTable()->in_use->count_cuted_fields &&
131
if (table->in_use->count_cuted_fields &&
147
132
check_int(cs, from, len, end, error))
189
173
pointer to decimal buffer with value of field
192
type::Decimal* Field_num::val_decimal(type::Decimal *decimal_value)
176
my_decimal* Field_num::val_decimal(my_decimal *decimal_value)
194
178
assert(result_type() == INT_RESULT);
196
180
int64_t nr= val_int();
197
int2_class_decimal(E_DEC_FATAL_ERROR, nr, false, decimal_value);
181
int2my_decimal(E_DEC_FATAL_ERROR, nr, false, decimal_value);
198
182
return decimal_value;