~xnox/ubuntu/saucy/drizzle/merge

« back to all changes in this revision

Viewing changes to drizzled/field_conv.cc

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2011-01-01 13:55:03 UTC
  • Revision ID: james.westby@ubuntu.com-20110101135503-x2ub1akxoisgwi6z
Tags: 2010.12.06-0ubuntu4
* Fixed missing build depends.
* Added Lee to uploaders.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
#include <drizzled/field/int32.h>
42
42
#include <drizzled/field/int64.h>
43
43
#include <drizzled/field/num.h>
44
 
#include <drizzled/field/timestamp.h>
 
44
#include <drizzled/field/epoch.h>
45
45
#include <drizzled/field/datetime.h>
46
46
#include <drizzled/field/varstring.h>
47
47
 
180
180
    field->reset();
181
181
    return 0;
182
182
  }
 
183
 
183
184
  if (no_conversions)
184
185
    return -1;
185
186
 
190
191
  */
191
192
  if (field->type() == DRIZZLE_TYPE_TIMESTAMP)
192
193
  {
193
 
    ((Field_timestamp*) field)->set_time();
 
194
    ((field::Epoch::pointer) field)->set_time();
194
195
    return 0;                                   // Ok to set time to NULL
195
196
  }
 
197
 
196
198
  field->reset();
197
199
  if (field == field->getTable()->next_number_field)
198
200
  {
199
201
    field->getTable()->auto_increment_field_not_null= false;
200
202
    return 0;                             // field is set in fill_record()
201
203
  }
 
204
 
202
205
  if (field->getTable()->in_use->count_cuted_fields == CHECK_FIELD_WARN)
203
206
  {
204
207
    field->set_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN, ER_BAD_NULL_ERROR, 1);
205
208
    return 0;
206
209
  }
 
210
 
207
211
  if (!field->getTable()->in_use->no_errors)
208
212
    my_error(ER_BAD_NULL_ERROR, MYF(0), field->field_name);
 
213
 
209
214
  return -1;
210
215
}
211
216
 
278
283
  if (*copy->from_null_ptr & copy->from_bit)
279
284
  {
280
285
    /* Same as in set_field_to_null_with_conversions() */
281
 
    ((Field_timestamp*) copy->to_field)->set_time();
 
286
    ((field::Epoch::pointer) copy->to_field)->set_time();
282
287
  }
283
288
  else
 
289
  {
284
290
    (copy->do_copy2)(copy);
 
291
  }
285
292
}
286
293
 
287
294
 
294
301
    copy->to_field->reset();
295
302
  }
296
303
  else
 
304
  {
297
305
    (copy->do_copy2)(copy);
 
306
  }
298
307
}
299
308
 
300
309
 
362
371
 
363
372
static void do_field_decimal(CopyField *copy)
364
373
{
365
 
  my_decimal value;
 
374
  type::Decimal value;
366
375
  copy->to_field->store_decimal(copy->from_field->val_decimal(&value));
367
376
}
368
377
 
842
851
    return to->store(from->val_real());
843
852
  else if (from->result_type() == DECIMAL_RESULT)
844
853
  {
845
 
    my_decimal buff;
 
854
    type::Decimal buff;
846
855
    return to->store_decimal(from->val_decimal(&buff));
847
856
  }
848
857
  else