~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/message/statement_transform.cc

  • Committer: Stewart Smith
  • Date: 2010-06-30 05:26:21 UTC
  • mto: (1720.1.1 drizzle)
  • mto: This revision was merged to the branch mainline in revision 1721.
  • Revision ID: stewart@flamingspork.com-20100630052621-cxbw6hco379o354d
fix display of VARBINARY default values in SHOW CREATE TABLE. Always use printable characters by encoding in hex.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1219
1219
  else if (field.options().has_default_bin_value())
1220
1220
  {
1221
1221
    const string &v= field.options().default_bin_value();
1222
 
    destination.append(" DEFAULT 0x", 11);
1223
 
    for (size_t x= 0; x < v.length(); x++)
 
1222
    if (v.length() == 0)
 
1223
      destination.append(" DEFAULT ''", 11);
 
1224
    else
1224
1225
    {
1225
 
      printf("%.2x", *(v.c_str() + x));
 
1226
      destination.append(" DEFAULT 0x", 11);
 
1227
      for (size_t x= 0; x < v.length(); x++)
 
1228
      {
 
1229
        char hex[3];
 
1230
        snprintf(hex, sizeof(hex), "%.2X", *(v.c_str() + x));
 
1231
        destination.append(hex, 2);
 
1232
      }
1226
1233
    }
1227
1234
  }
1228
1235
  else if (field.options().has_default_null())