~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/num.cc

  • Committer: Monty Taylor
  • Date: 2008-11-16 06:29:53 UTC
  • mto: (584.1.9 devel)
  • mto: This revision was merged to the branch mainline in revision 589.
  • Revision ID: monty@inaugust.com-20081116062953-ivdltjmfe009b5fr
Moved stuff into item/

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 */
20
20
 
21
21
 
22
 
#include "config.h"
 
22
#include <drizzled/server_includes.h>
23
23
#include <drizzled/field/num.h>
24
24
#include <drizzled/error.h>
25
 
#include <drizzled/table.h>
26
 
#include <drizzled/session.h>
27
 
#include "drizzled/internal/my_sys.h"
28
 
 
29
 
namespace drizzled
30
 
{
31
25
 
32
26
/**
33
27
  Numeric fields base class constructor.
74
68
    char buff[128];
75
69
    String tmp(buff, (uint32_t) sizeof(buff), system_charset_info);
76
70
    tmp.copy(str, length, system_charset_info);
77
 
    push_warning_printf(getTable()->in_use, DRIZZLE_ERROR::WARN_LEVEL_WARN,
 
71
    push_warning_printf(table->in_use, DRIZZLE_ERROR::WARN_LEVEL_WARN,
78
72
                        ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
79
73
                        ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
80
74
                        "integer", tmp.c_ptr(), field_name,
81
 
                        (uint32_t) getTable()->in_use->row_count);
 
75
                        (uint32_t) table->in_use->row_count);
82
76
    return 1;
83
77
  }
84
78
  /* Test if we have garbage at the end of the given string. */
114
108
*/
115
109
 
116
110
bool Field_num::get_int(const CHARSET_INFO * const cs, const char *from, uint32_t len,
117
 
                        int64_t *rnd, uint64_t ,
 
111
                        int64_t *rnd, uint64_t unsigned_max __attribute__((unused)),
118
112
                        int64_t signed_min, int64_t signed_max)
119
113
{
120
114
  char *end;
132
126
    goto out_of_range;
133
127
  }
134
128
 
135
 
  if (getTable()->in_use->count_cuted_fields &&
 
129
  if (table->in_use->count_cuted_fields &&
136
130
      check_int(cs, from, len, end, error))
137
131
    return 1;
138
132
  return 0;
180
174
my_decimal* Field_num::val_decimal(my_decimal *decimal_value)
181
175
{
182
176
  assert(result_type() == INT_RESULT);
183
 
 
184
177
  int64_t nr= val_int();
185
178
  int2my_decimal(E_DEC_FATAL_ERROR, nr, false, decimal_value);
186
179
  return decimal_value;
187
180
}
188
181
 
189
182
 
190
 
void Field_num::make_field(SendField *field)
 
183
void Field_num::make_field(Send_field *field)
191
184
{
192
185
  Field::make_field(field);
193
186
  field->decimals= dec;
208
201
  return 1;
209
202
}
210
203
 
211
 
uint32_t Field_num::is_equal(CreateField *new_field_ptr)
 
204
uint32_t Field_num::is_equal(Create_field *new_field)
212
205
{
213
 
  return ((new_field_ptr->sql_type == real_type()) &&
214
 
          ((new_field_ptr->flags & UNSIGNED_FLAG) ==
215
 
           (uint32_t) (flags & UNSIGNED_FLAG)) &&
216
 
          ((new_field_ptr->flags & AUTO_INCREMENT_FLAG) ==
 
206
  return ((new_field->sql_type == real_type()) &&
 
207
          ((new_field->flags & UNSIGNED_FLAG) == (uint32_t) (flags &
 
208
                                                         UNSIGNED_FLAG)) &&
 
209
          ((new_field->flags & AUTO_INCREMENT_FLAG) ==
217
210
           (uint32_t) (flags & AUTO_INCREMENT_FLAG)) &&
218
 
          (new_field_ptr->length <= max_display_length()));
 
211
          (new_field->length <= max_display_length()));
219
212
}
220
213
 
221
214
 
222
 
} /* namespace drizzled */