~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/message/statement_transform.cc

  • Committer: lbieber
  • Date: 2010-09-20 18:35:09 UTC
  • mfrom: (1779.1.4 build)
  • Revision ID: lbieber@orisndriz08-20100920183509-zjw31nf3f8clzu8k
Merge Joe - fix bug 641685 statement_transform.cc was not handling NULL values when dealing with NULL values.
Merge Shrews - fix bug 641687 - Quote ENUM values when building SQL from GPB Transaction messages.
Merge Monty - fix bug 549882 - Throw an error in configure from a bad --prefix value
Merge Monty - fix bug 565050 - Don't fail if root user runs drizzled --help

Show diffs side-by-side

added added

removed removed

Lines of Context:
389
389
    if (should_quote_field_value)
390
390
      destination.push_back('\'');
391
391
 
392
 
    if (field_metadata.type() == Table::Field::BLOB)
 
392
    if (record.is_null(x))
393
393
    {
394
 
      /* 
395
 
        * We do this here because BLOB data is returned
396
 
        * in a string correctly, but calling append()
397
 
        * without a length will result in only the string
398
 
        * up to a \0 being output here.
399
 
        */
400
 
      string raw_data(record.insert_value(x));
401
 
      destination.append(raw_data.c_str(), raw_data.size());
 
394
      destination.append("NULL");
402
395
    }
403
396
    else
404
397
    {
405
 
      if (record.is_null(x))
 
398
      if (field_metadata.type() == Table::Field::BLOB)
406
399
      {
407
 
        destination.append("NULL");
 
400
        /*
 
401
         * We do this here because BLOB data is returned
 
402
         * in a string correctly, but calling append()
 
403
         * without a length will result in only the string
 
404
         * up to a \0 being output here.
 
405
         */
 
406
        string raw_data(record.insert_value(x));
 
407
        destination.append(raw_data.c_str(), raw_data.size());
408
408
      }
409
 
      else 
 
409
      else
410
410
      {
411
411
        destination.append(record.insert_value(x));
412
 
      } 
 
412
      }
413
413
    }
414
414
 
415
415
    if (should_quote_field_value)
548
548
    if (should_quote_field_value)
549
549
      destination.push_back('\'');
550
550
 
551
 
    if (field_metadata.type() == Table::Field::BLOB)
 
551
    if (record.is_null(x))
552
552
    {
553
 
      /* 
554
 
       * We do this here because BLOB data is returned
555
 
       * in a string correctly, but calling append()
556
 
       * without a length will result in only the string
557
 
       * up to a \0 being output here.
558
 
       */
559
 
      string raw_data(record.after_value(x));
560
 
      destination.append(raw_data.c_str(), raw_data.size());
 
553
      destination.append("NULL");
561
554
    }
562
 
    else
 
555
    else 
563
556
    {
564
 
      if (record.is_null(x))
 
557
      if (field_metadata.type() == Table::Field::BLOB)
565
558
      {
566
 
        destination.append("NULL");
 
559
        /*
 
560
         * We do this here because BLOB data is returned
 
561
         * in a string correctly, but calling append()
 
562
         * without a length will result in only the string
 
563
         * up to a \0 being output here.
 
564
         */
 
565
        string raw_data(record.after_value(x));
 
566
        destination.append(raw_data.c_str(), raw_data.size());
567
567
      }
568
 
      else
 
568
      else 
569
569
      {
570
570
        destination.append(record.after_value(x));
571
571
      }
1455
1455
  case Table::Field::DECIMAL:
1456
1456
  case Table::Field::INTEGER:
1457
1457
  case Table::Field::BIGINT:
1458
 
  case Table::Field::ENUM:
1459
1458
    return false;
1460
1459
  default:
1461
1460
    return true;