~maria-captains/maria/mysql-6.0-backup

« back to all changes in this revision

Viewing changes to sql/backup/be_default.cc

  • Committer: Thava Alagu
  • Date: 2010-03-11 18:30:05 UTC
  • mfrom: (3825.2.12 mysql-6.0-backup)
  • Revision ID: thavamuni.alagu@sun.com-20100311183005-d61ot1syu9n91c0s
auto-merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
549
549
  case READ_BLOB:
550
550
  {
551
551
    uint32 size= ((Field_blob*) cur_table->field[*cur_blob])->get_length();
 
552
 
 
553
    /*
 
554
      Check to see if blob field is null first. If null, set bit to tell
 
555
      restore to set the field to null.
 
556
    */
 
557
    if (((Field_blob*) cur_table->field[*cur_blob])->is_null())
 
558
      *buf.data= BLOB_NULL;
 
559
    else
 
560
      *buf.data= 0;
 
561
      
552
562
    /*
553
563
      Check size of buffer to ensure data fits in the buffer. If it does
554
564
      not fit, create new blob_buffer object.
555
565
    */
556
566
    if ((size + META_SIZE) <= buf.size)
557
567
    {
558
 
      *buf.data= BLOB_ONCE;
 
568
      *buf.data|= BLOB_ONCE;
559
569
      ((Field_blob*) cur_table->field[*cur_blob])->get_ptr((uchar **)&ptr);
560
570
      memcpy((byte *)buf.data + META_SIZE, ptr, size);
561
571
      buf.size = size + META_SIZE;
568
578
 
569
579
      ((Field_blob*) cur_table->field[*cur_blob])->get_ptr((uchar **)&ptr);
570
580
      blob_buffer.initialize((byte *)ptr, size);
571
 
      *buf.data= BLOB_FIRST;   // First block.
 
581
      *buf.data|= BLOB_FIRST;   // First block.
572
582
      uint32 field_size=
573
583
        ((Field_blob*) cur_table->field[*cur_blob])->get_length();
574
584
      int4store(buf.data + META_SIZE, field_size);     // Save max size.
797
807
          hdl->ha_reset_auto_increment(auto_incr);
798
808
          break;
799
809
        }
800
 
 
 
810
        
801
811
      // Buffer iterator not needed, just write the data.
802
812
      case RCD_ONCE:
803
813
      {
910
920
  case WRITE_BLOB:
911
921
  {
912
922
    uint32 size= buf.size - META_SIZE;
 
923
    bool set_null= (*buf.data & BLOB_NULL);
913
924
 
 
925
    // Mask the null status indicator.
 
926
    *buf.data&= BLOB_CTRL;
 
927
    
 
928
    /* 
 
929
      BUG#50357 : Need to check for null fields set at backup time.
 
930
      In this case, we check for null status and set the field accordingly. 
 
931
      If we do not set the field to null, check to see if the length
 
932
      is 0. If it is, then we have a non-null field with a zero length
 
933
      string (e.g. '').
 
934
    */
 
935
    if (*buf.data & (BLOB_ONCE | BLOB_FIRST))
 
936
    {
 
937
      if (set_null)
 
938
        cur_table->field[*cur_blob]->set_null();
 
939
      else if (size == 0)
 
940
        cur_table->field[*cur_blob]->set_notnull();
 
941
    }
 
942
    
914
943
    block_type= *buf.data;
915
944
    switch (block_type) {
916
945