~ubuntu-branches/ubuntu/maverick/mysql-5.1/maverick-proposed

« back to all changes in this revision

Viewing changes to storage/csv/ha_tina.cc

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 14:16:05 UTC
  • mto: This revision was merged to the branch mainline in revision 20.
  • Revision ID: package-import@ubuntu.com-20120222141605-nxlu9yzc6attylc2
Tags: upstream-5.1.61
ImportĀ upstreamĀ versionĀ 5.1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2003 MySQL AB
 
1
/*
 
2
   Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
2
3
 
3
4
  This program is free software; you can redistribute it and/or modify
4
5
  it under the terms of the GNU General Public License as published by
11
12
 
12
13
  You should have received a copy of the GNU General Public License
13
14
  along with this program; if not, write to the Free Software
14
 
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
 
16
*/
15
17
 
16
18
/*
17
19
  Make sure to look at ha_tina.h for more details.
468
470
    const char *ptr;
469
471
    const char *end_ptr;
470
472
    const bool was_null= (*field)->is_null();
471
 
    
 
473
 
472
474
    /*
473
475
      assistance for backwards compatibility in production builds.
474
476
      note: this will not work for ENUM columns.
480
482
    }
481
483
 
482
484
    (*field)->val_str(&attribute,&attribute);
483
 
    
 
485
 
484
486
    if (was_null)
485
487
      (*field)->set_null();
486
488
 
491
493
 
492
494
      buffer.append('"');
493
495
 
494
 
      while (ptr < end_ptr) 
 
496
      for (; ptr < end_ptr; ptr++)
495
497
      {
496
498
        if (*ptr == '"')
497
499
        {
498
500
          buffer.append('\\');
499
501
          buffer.append('"');
500
 
          *ptr++;
501
502
        }
502
503
        else if (*ptr == '\r')
503
504
        {
504
505
          buffer.append('\\');
505
506
          buffer.append('r');
506
 
          *ptr++;
507
507
        }
508
508
        else if (*ptr == '\\')
509
509
        {
510
510
          buffer.append('\\');
511
511
          buffer.append('\\');
512
 
          *ptr++;
513
512
        }
514
513
        else if (*ptr == '\n')
515
514
        {
516
515
          buffer.append('\\');
517
516
          buffer.append('n');
518
 
          *ptr++;
519
517
        }
520
518
        else
521
 
          buffer.append(*ptr++);
 
519
          buffer.append(*ptr);
522
520
      }
523
521
      buffer.append('"');
524
522
    }