~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/message/statement_transform.cc

  • Committer: lbieber
  • Date: 2010-09-23 15:49:15 UTC
  • mfrom: (1788.1.3 build)
  • Revision ID: lbieber@orisndriz08-20100923154915-mshh9pwln0igdwrn
Merge Brian - Rollup patch of enum + style on varchar. This modifies enum to always being the same value.
Merge Stewart - Fix embedded_innodb plugin now that TIMESTAMP is 8 bytes. 
Merge Shrews - fix bug 643630 -  Transaction_reader not handling CHAR values that include quotes properly

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
namespace message
52
52
{
53
53
 
 
54
static void escapeEmbeddedQuotes(string &s, const char quote='\'')
 
55
{
 
56
  string::iterator it;
 
57
 
 
58
  for (it= s.begin(); it != s.end(); ++it)
 
59
  {
 
60
    if (*it == quote)
 
61
    {
 
62
      it= s.insert(it, quote);
 
63
      ++it;  // advance back to the quote
 
64
    }
 
65
  }
 
66
}
 
67
 
54
68
/* Incredibly similar to append_unescaped() in table.cc, but for std::string */
55
69
static void append_escaped_string(std::string *res, const std::string &input, const char quote='\'')
56
70
{
408
422
      }
409
423
      else
410
424
      {
411
 
        destination.append(record.insert_value(x));
 
425
        string tmp(record.insert_value(x));
 
426
        escapeEmbeddedQuotes(tmp);
 
427
        destination.append(tmp);
412
428
      }
413
429
    }
414
430
 
472
488
      }
473
489
      else
474
490
      {
475
 
        destination.append(data.record(x).insert_value(y));
 
491
        string tmp(data.record(x).insert_value(y));
 
492
        escapeEmbeddedQuotes(tmp);
 
493
        destination.append(tmp);
476
494
      }
477
495
 
478
496
      if (should_quote_field_value)
567
585
      }
568
586
      else 
569
587
      {
570
 
        destination.append(record.after_value(x));
 
588
        string tmp(record.after_value(x));
 
589
        escapeEmbeddedQuotes(tmp);
 
590
        destination.append(tmp);
571
591
      }
572
592
    }
573
593
 
690
710
    }
691
711
    else
692
712
    {
693
 
      destination.append(record.key_value(x));
 
713
      string tmp(record.key_value(x));
 
714
      escapeEmbeddedQuotes(tmp);
 
715
      destination.append(tmp);
694
716
    }
695
717
 
696
718
    if (should_quote_field_value)
759
781
      }
760
782
      else
761
783
      {
762
 
        destination.append(data.record(x).key_value(y));
 
784
        string tmp(data.record(x).key_value(y));
 
785
        escapeEmbeddedQuotes(tmp);
 
786
        destination.append(tmp);
763
787
      }
764
788
 
765
789
      if (should_quote_field_value)