~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/fstring.cc

  • Committer: Monty Taylor
  • Date: 2008-07-31 05:13:04 UTC
  • mfrom: (240 drizzle)
  • mto: (202.3.5 gettextize)
  • mto: This revision was merged to the branch mainline in revision 243.
  • Revision ID: monty@inaugust.com-20080731051304-a9kawbozru3fic1g
MergedĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
203
203
 
204
204
  length= cs->cset->snprintf(cs,(char*) res.ptr(),
205
205
                             res.alloced_length(), "%s(%d)",
206
 
                             ((type() == DRIZZLE_TYPE_VAR_STRING &&
 
206
                             ((type() == DRIZZLE_TYPE_VARCHAR &&
207
207
                               !thd->variables.new_mode) ?
208
208
                              (has_charset() ? "varchar" : "varbinary") :
209
209
                              (has_charset() ? "char" : "binary")),
210
210
                             (int) field_length / charset()->mbmaxlen);
211
211
  res.length(length);
212
 
  if ((thd->variables.sql_mode & (MODE_MYSQL323 | MODE_MYSQL40)) &&
213
 
      has_charset() && (charset()->state & MY_CS_BINSORT))
214
 
    res.append(STRING_WITH_LEN(" binary"));
215
212
}
216
213
 
217
214
 
412
409
                               bool keep_type)
413
410
{
414
411
  Field *field;
415
 
  if (type() != DRIZZLE_TYPE_VAR_STRING || keep_type)
416
 
    field= Field::new_field(root, new_table, keep_type);
417
 
  else if ((field= new Field_varstring(field_length, maybe_null(), field_name,
418
 
                                       new_table->s, charset())))
419
 
  {
420
 
    /*
421
 
      Old VARCHAR field which should be modified to a VARCHAR on copy
422
 
      This is done to ensure that ALTER TABLE will convert old VARCHAR fields
423
 
      to now VARCHAR fields.
424
 
    */
425
 
    field->init(new_table);
426
 
    /*
427
 
      Normally orig_table is different from table only if field was created
428
 
      via ::new_field.  Here we alter the type of field, so ::new_field is
429
 
      not applicable. But we still need to preserve the original field
430
 
      metadata for the client-server protocol.
431
 
    */
432
 
    field->orig_table= orig_table;
433
 
  }
 
412
  field= Field::new_field(root, new_table, keep_type);
434
413
  return field;
435
414
}
436
415