~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field_conv.cc

  • Committer: Eric Herman
  • Date: 2008-12-06 19:42:46 UTC
  • mto: (656.1.6 devel)
  • mto: This revision was merged to the branch mainline in revision 665.
  • Revision ID: eric@mysql.com-20081206194246-5cdexuu81i366eek
removed trailing whitespace with simple script:

for file in $(find . -name "*.c") $(find . -name "*.cc") $(find . -name "*.h"); do ruby -pe 'gsub(/\s+$/, $/)' < $file > $file.out; mv $file.out $file; done;

Show diffs side-by-side

added added

removed removed

Lines of Context:
395
395
  const unsigned char *from_end= copy->from_ptr + copy->from_length;
396
396
  uint32_t copy_length= cs->cset->well_formed_len(cs,
397
397
                                              (char*) copy->from_ptr,
398
 
                                              (char*) from_end, 
 
398
                                              (char*) from_end,
399
399
                                              copy->to_length / cs->mbmaxlen,
400
400
                                              &well_formed_error);
401
401
  if (copy->to_length < copy_length)
506
506
    if (current_session->count_cuted_fields)
507
507
      copy->to_field->set_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN,
508
508
                                  ER_WARN_DATA_TRUNCATED, 1);
509
 
  }  
 
509
  }
510
510
  int2store(copy->to_ptr, length);
511
511
  memcpy(copy->to_ptr+HA_KEY_BLOB_LENGTH, from_beg, length);
512
512
}
513
 
 
 
513
 
514
514
 
515
515
/***************************************************************************
516
516
** The different functions that fills in a Copy_field class
553
553
 
554
554
 
555
555
/*
556
 
  To do: 
 
556
  To do:
557
557
 
558
558
  If 'save\ is set to true and the 'from' is a blob field, do_copy is set to
559
559
  do_save_blob rather than do_conv_blob.  The only differences between them
560
560
  appears to be:
561
561
 
562
 
  - do_save_blob allocates and uses an intermediate buffer before calling 
563
 
    Field_blob::store. Is this in order to trigger the call to 
 
562
  - do_save_blob allocates and uses an intermediate buffer before calling
 
563
    Field_blob::store. Is this in order to trigger the call to
564
564
    well_formed_copy_nchars, by changing the pointer copy->tmp.ptr()?
565
565
    That call will take place anyway in all known cases.
566
566
 
567
 
  - The above causes a truncation to MAX_FIELD_WIDTH. Is this the intended 
 
567
  - The above causes a truncation to MAX_FIELD_WIDTH. Is this the intended
568
568
    effect? Truncation is handled by well_formed_copy_nchars anyway.
569
569
 */
570
570
void Copy_field::set(Field *to,Field *from,bool save)
745
745
      !(to->type() == DRIZZLE_TYPE_BLOB && to->table->copy_blobs))
746
746
  {
747
747
    /* Please god, will someone rewrite this to be readable :( */
748
 
    if (to->pack_length() == from->pack_length() && 
749
 
        !(to->flags & UNSIGNED_FLAG && !(from->flags & UNSIGNED_FLAG)) && 
750
 
        to->real_type() != DRIZZLE_TYPE_ENUM && 
 
748
    if (to->pack_length() == from->pack_length() &&
 
749
        !(to->flags & UNSIGNED_FLAG && !(from->flags & UNSIGNED_FLAG)) &&
 
750
        to->real_type() != DRIZZLE_TYPE_ENUM &&
751
751
        (to->real_type() != DRIZZLE_TYPE_NEWDECIMAL || (to->field_length == from->field_length && (((Field_num*)to)->dec == ((Field_num*)from)->dec))) &&
752
752
        from->charset() == to->charset() &&
753
753
        to->table->s->db_low_byte_first == from->table->s->db_low_byte_first &&
754
 
        (!(to->table->in_use->variables.sql_mode & (MODE_NO_ZERO_DATE | MODE_INVALID_DATES)) || (to->type() != DRIZZLE_TYPE_DATE && to->type() != DRIZZLE_TYPE_DATETIME)) && 
 
754
        (!(to->table->in_use->variables.sql_mode & (MODE_NO_ZERO_DATE | MODE_INVALID_DATES)) || (to->type() != DRIZZLE_TYPE_DATE && to->type() != DRIZZLE_TYPE_DATETIME)) &&
755
755
        (from->real_type() != DRIZZLE_TYPE_VARCHAR || ((Field_varstring*)from)->length_bytes == ((Field_varstring*)to)->length_bytes))
756
756
    {                                           // Identical fields
757
757
      /* This may happen if one does 'UPDATE ... SET x=x' */