~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzledump_data.cc

  • Committer: Stewart Smith
  • Author(s): Marko Mäkelä, Stewart Smith
  • Date: 2010-11-17 05:52:09 UTC
  • mto: (2021.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1971.
  • Revision ID: stewart@flamingspork.com-20101117055209-69m035q6h7e1txrc
Merge Revision revid:marko.makela@oracle.com-20100629113248-fvl48lnzr44z94gg from MySQL InnoDB

Original revid:marko.makela@oracle.com-20100629113248-fvl48lnzr44z94gg

Original Authors: Marko Mkel <marko.makela@oracle.com>
Original commit message:
Bug#52199 utf32: mbminlen=4, mbmaxlen=4, type->mbminlen=0, type->mbmaxlen=4

Merge and adjust a forgotten change to fix this bug.
rb://393 approved by Jimmy Yang
  ------------------------------------------------------------------------
  r3794 | marko | 2009-01-07 14:14:53 +0000 (Wed, 07 Jan 2009) | 18 lines

  branches/6.0: Allow the minimum length of a multi-byte character to be
  up to 4 bytes. (Bug #35391)

  dtype_t, dict_col_t: Replace mbminlen:2, mbmaxlen:3 with mbminmaxlen:5.
  In this way, the 5 bits can hold two values of 0..4, and the storage size
  of the fields will not cross the 64-bit boundary.  Encode the values as
  DATA_MBMAX * mbmaxlen + mbminlen.  Define the auxiliary macros
  DB_MBMINLEN(mbminmaxlen), DB_MBMAXLEN(mbminmaxlen), and
  DB_MINMAXLEN(mbminlen, mbmaxlen).

  Try to trim and pad UTF-16 and UTF-32 with spaces as appropriate.

  Alexander Barkov suggested the use of cs->cset->fill(cs, buff, len, 0x20).
  ha_innobase::store_key_val_for_row() now does that, but the added function
  row_mysql_pad_col() does not, because it doesn't have the MySQL TABLE object.

  rb://49 approved by Heikki Tuuri
  ------------------------------------------------------------------------

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
558
526
  if (ret != DRIZZLE_RETURN_OK)
559
527
  {
560
528
    errorHandler(NULL, ret, "when trying to connect");
561
 
    throw std::exception();
 
529
    throw 1;
562
530
  }
563
531
 
564
532
  boost::match_flag_type flags = boost::match_default;