~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzledump_data.cc

  • Committer: Brian Aker
  • Date: 2010-10-24 01:34:39 UTC
  • mto: This revision was merged to the branch mainline in revision 1875.
  • Revision ID: brian@tangent.org-20101024013439-w9r8qtmt5ihnqtkd
Encapsulate table_name from table_list.

Show diffs side-by-side

added added

removed removed

Lines of Context:
166
166
  if (not obj.defaultValue.empty())
167
167
  {
168
168
    if (obj.defaultValue.compare("CURRENT_TIMESTAMP") != 0)
169
 
    {
170
 
      if (obj.defaultValue.compare(0, 2, "b'") == 0)
171
 
      {
172
 
        os << " DEFAULT " << obj.defaultValue;
173
 
      }
174
 
      else
175
 
      {
176
 
        os << " DEFAULT '" << obj.defaultValue << "'";
177
 
      }
178
 
    }
 
169
     os << " DEFAULT '" << obj.defaultValue << "'";
179
170
    else
180
 
    {
181
171
     os << " DEFAULT CURRENT_TIMESTAMP";
182
 
    }
183
172
  }
184
173
  else if ((obj.defaultIsNull))
185
174
  {
186
175
    os << " DEFAULT NULL";
187
176
  }
188
177
 
189
 
  if (not obj.comment.empty())
190
 
  {
191
 
    os << " COMMENT '" << DrizzleDumpData::escape(obj.comment.c_str(), obj.comment.length()) << "'";
192
 
  }
193
 
 
194
178
  return os;
195
179
}
196
180
 
335
319
      if (not row[i])
336
320
      {
337
321
        os << "NULL";
338
 
        if (i != obj.table->fields.size() - 1)
339
 
          os << ",";
340
 
        continue;
341
 
      }
342
 
 
343
 
      if ((obj.table->fields[i]->rangeCheck) and
344
 
        (obj.table->fields[i]->type.compare("BIGINT") == 0) and
345
 
        (boost::lexical_cast<uint64_t>(row[i]) > INT64_MAX))
346
 
      {
347
 
        std::cerr << "Error: Data for column " << obj.table->fields[i]->fieldName << " is greater than max BIGINT, cannot migrate automatically" << std::endl;
348
 
        if (not ignore_errors)
349
 
          maybe_exit(EX_DRIZZLEERR);
350
 
        else
351
 
          continue;
352
 
      }
353
 
 
 
322
      }
354
323
      /* time/date conversion for MySQL connections */
355
324
      else if (obj.table->fields[i]->convertDateTime)
356
325
      {
358
327
      }
359
328
      else
360
329
      {
361
 
        if ((obj.table->fields[i]->type.compare("INT") != 0) and
362
 
          (obj.table->fields[i]->type.compare("BIGINT") != 0))
 
330
        if (obj.table->fields[i]->type.compare("INT") != 0)
363
331
        {
364
332
          /* Hex blob processing or escape text */
365
333
          if (((obj.table->fields[i]->type.compare("BLOB") == 0) or
368
336
            os << obj.convertHex((unsigned char*)row[i], row_sizes[i]);
369
337
            byte_counter+= row_sizes[i];
370
338
          }
371
 
          else if ((obj.table->fields[i]->type.compare("ENUM") == 0) and
372
 
            (strcmp(row[i], "") == 0))
373
 
          {
374
 
            os << "NULL";
375
 
          }
376
339
          else
377
340
            os << "'" << DrizzleDumpData::escape(row[i], row_sizes[i]) << "'";
378
341
          byte_counter+= 3;
411
374
  std::ostringstream output;
412
375
  if (from_size > 0)
413
376
    output << "0x";
414
 
  else
415
 
    output << "''";
416
 
 
417
377
  while (from_size > 0)
418
378
  {
419
379
    /* Would be nice if std::hex liked uint8_t, ah well */
513
473
  }
514
474
 
515
475
  os << std::endl;
516
 
  os << ") ENGINE='" << obj.engineName << "' ";
 
476
  os << ") ENGINE=" << obj.engineName << " ";
517
477
  if (obj.autoIncrement > 0)
518
478
  {
519
479
    os << "AUTO_INCREMENT=" << obj.autoIncrement << " ";
520
480
  }
521
481
 
522
 
  os << "COLLATE='" << obj.collate << "'";
 
482
  os << "COLLATE = " << obj.collate;
523
483
 
524
484
  if (not obj.comment.empty())
525
485
  {
526
 
    os << " COMMENT='" << obj.comment << "'";
 
486
    os << " COMMENT = '" << obj.comment << "'";
527
487
  }
528
488
 
529
489
  os << ";" << std::endl << std::endl;
558
518
  if (ret != DRIZZLE_RETURN_OK)
559
519
  {
560
520
    errorHandler(NULL, ret, "when trying to connect");
561
 
    throw std::exception();
 
521
    throw 1;
562
522
  }
563
523
 
564
524
  boost::match_flag_type flags = boost::match_default;