38
40
unsigned char null_bit_arg,
39
41
enum utype unireg_check_arg,
40
42
const char *field_name_arg,
51
precision= class_decimal_length_to_precision(len_arg, dec_arg, false);
52
set_if_smaller(precision, (uint32_t)DECIMAL_MAX_PRECISION);
53
assert((precision <= DECIMAL_MAX_PRECISION) && (dec <= DECIMAL_MAX_SCALE));
54
bin_size= class_decimal_get_binary_size(precision, dec);
55
precision= class_decimal_length_to_precision(len_arg, dec_arg, unsigned_arg);
56
set_if_smaller(precision, (uint32_t)DECIMAL_MAX_PRECISION);
57
assert((precision <= DECIMAL_MAX_PRECISION) &&
58
(dec <= DECIMAL_MAX_SCALE));
59
bin_size= class_decimal_get_binary_size(precision, dec);
57
62
Field_decimal::Field_decimal(uint32_t len_arg,
58
63
bool maybe_null_arg,
62
Field_num((unsigned char*) 0,
64
maybe_null_arg ? (unsigned char*) "": 0,
67
:Field_num((unsigned char*) 0,
69
maybe_null_arg ? (unsigned char*) "": 0,
72
77
precision= class_decimal_length_to_precision(len_arg, dec_arg, unsigned_arg);
73
78
set_if_smaller(precision, (uint32_t)DECIMAL_MAX_PRECISION);
139
144
int Field_decimal::store(const char *from, uint32_t length,
140
const charset_info_st * const charset_arg)
145
const CHARSET_INFO * const charset_arg)
143
148
type::Decimal decimal_value;
299
String *Field_decimal::val_str(String *val_buffer, String *) const
304
String *Field_decimal::val_str(String *val_buffer,
301
307
type::Decimal decimal_value;
303
309
ASSERT_COLUMN_MARKED_FOR_READ;
305
class_decimal2string(val_decimal(&decimal_value),
311
uint32_t fixed_precision= decimal_precision ? precision : 0;
312
class_decimal2string(E_DEC_FATAL_ERROR, val_decimal(&decimal_value),
313
fixed_precision, dec, '0', val_buffer);
307
314
return val_buffer;
324
331
void Field_decimal::sql_type(String &str) const
326
const charset_info_st * const cs= str.charset();
333
const CHARSET_INFO * const cs= str.charset();
327
334
str.length(cs->cset->snprintf(cs, (char*) str.ptr(), str.alloced_length(),
328
335
"decimal(%d,%d)", precision, (int)dec));