~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/num.cc

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
/**
33
33
  Numeric fields base class constructor.
34
34
*/
35
 
Field_num::Field_num(unsigned char *ptr_arg,uint32_t len_arg, unsigned char *null_ptr_arg,
36
 
                     unsigned char null_bit_arg, utype unireg_check_arg,
 
35
Field_num::Field_num(unsigned char *ptr_arg,
 
36
                     uint32_t len_arg,
 
37
                     unsigned char *null_ptr_arg,
 
38
                     unsigned char null_bit_arg,
 
39
                     utype unireg_check_arg,
37
40
                     const char *field_name_arg,
38
 
                     uint8_t dec_arg, bool zero_arg, bool unsigned_arg)
39
 
  :Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
40
 
         unireg_check_arg, field_name_arg),
41
 
  dec(dec_arg),decimal_precision(zero_arg), unsigned_flag(unsigned_arg)
42
 
{
 
41
                     uint8_t dec_arg,
 
42
                     bool zero_arg,
 
43
                     bool unsigned_arg) :
 
44
  Field(ptr_arg,
 
45
        len_arg,
 
46
        null_ptr_arg,
 
47
        null_bit_arg,
 
48
        unireg_check_arg,
 
49
        field_name_arg),
 
50
  dec(dec_arg),
 
51
  decimal_precision(zero_arg),
 
52
  unsigned_flag(unsigned_arg)
 
53
  {
43
54
}
44
55
 
45
56
 
74
85
    char buff[128];
75
86
    String tmp(buff, (uint32_t) sizeof(buff), system_charset_info);
76
87
    tmp.copy(str, length, system_charset_info);
77
 
    push_warning_printf(table->in_use, DRIZZLE_ERROR::WARN_LEVEL_WARN,
 
88
    push_warning_printf(getTable()->in_use, DRIZZLE_ERROR::WARN_LEVEL_WARN,
78
89
                        ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
79
90
                        ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
80
91
                        "integer", tmp.c_ptr(), field_name,
81
 
                        (uint32_t) table->in_use->row_count);
 
92
                        (uint32_t) getTable()->in_use->row_count);
82
93
    return 1;
83
94
  }
84
95
  /* Test if we have garbage at the end of the given string. */
132
143
    goto out_of_range;
133
144
  }
134
145
 
135
 
  if (table->in_use->count_cuted_fields &&
 
146
  if (getTable()->in_use->count_cuted_fields &&
136
147
      check_int(cs, from, len, end, error))
137
148
    return 1;
 
149
 
138
150
  return 0;
139
151
 
140
152
out_of_range:
156
168
    !=0  error
157
169
*/
158
170
 
159
 
int Field_num::store_decimal(const my_decimal *val)
 
171
int Field_num::store_decimal(const type::Decimal *val)
160
172
{
161
173
  int err= 0;
162
174
  int64_t i= convert_decimal2int64_t(val, false, &err);
177
189
    pointer to decimal buffer with value of field
178
190
*/
179
191
 
180
 
my_decimal* Field_num::val_decimal(my_decimal *decimal_value)
 
192
type::Decimal* Field_num::val_decimal(type::Decimal *decimal_value)
181
193
{
182
194
  assert(result_type() == INT_RESULT);
183
195
 
184
196
  int64_t nr= val_int();
185
 
  int2my_decimal(E_DEC_FATAL_ERROR, nr, false, decimal_value);
 
197
  int2_class_decimal(E_DEC_FATAL_ERROR, nr, false, decimal_value);
186
198
  return decimal_value;
187
199
}
188
200