~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/str.cc

  • Committer: Brian Aker
  • Date: 2010-05-18 22:31:57 UTC
  • mto: This revision was merged to the branch mainline in revision 1540.
  • Revision ID: brian@gaz-20100518223157-k0i4yxv6t03yrwyk
JoinCache rename.

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
int
74
74
Field_str::report_if_important_data(const char *field_ptr, const char *end)
75
75
{
76
 
  if ((field_ptr < end) && getTable()->in_use->count_cuted_fields)
 
76
  if ((field_ptr < end) && table->in_use->count_cuted_fields)
77
77
  {
78
 
    set_warning(DRIZZLE_ERROR::WARN_LEVEL_ERROR, ER_DATA_TOO_LONG, 1);
79
 
 
 
78
    if (test_if_important_data(field_charset, field_ptr, end))
 
79
    {
 
80
      if (table->in_use->abort_on_warning)
 
81
        set_warning(DRIZZLE_ERROR::WARN_LEVEL_ERROR, ER_DATA_TOO_LONG, 1);
 
82
      else
 
83
        set_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED, 1);
 
84
    }
 
85
    else /* If we lost only spaces then produce a NOTE, not a WARNING */
 
86
      set_warning(DRIZZLE_ERROR::WARN_LEVEL_NOTE, ER_WARN_DATA_TRUNCATED, 1);
80
87
    return 2;
81
88
  }
82
89
  return 0;
137
144
  length= internal::my_gcvt(nr, internal::MY_GCVT_ARG_DOUBLE, local_char_length, buff, &error);
138
145
  if (error)
139
146
  {
140
 
    if (getTable()->in_use->abort_on_warning)
 
147
    if (table->in_use->abort_on_warning)
141
148
      set_warning(DRIZZLE_ERROR::WARN_LEVEL_ERROR, ER_DATA_TOO_LONG, 1);
142
149
    else
143
150
      set_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED, 1);
194
201
    *t++= '.';
195
202
  }
196
203
  *t= '\0';
197
 
  push_warning_printf(field->getTable()->in_use,
198
 
                      field->getTable()->in_use->abort_on_warning ?
 
204
  push_warning_printf(field->table->in_use,
 
205
                      field->table->in_use->abort_on_warning ?
199
206
                      DRIZZLE_ERROR::WARN_LEVEL_ERROR :
200
207
                      DRIZZLE_ERROR::WARN_LEVEL_WARN,
201
208
                      ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
202
209
                      ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
203
210
                      "string", tmp, field->field_name,
204
 
                      (uint32_t) field->getTable()->in_use->row_count);
 
211
                      (uint32_t) field->table->in_use->row_count);
205
212
  return true;
206
213
}
207
214