~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_string.cc

  • Committer: Monty Taylor
  • Date: 2009-01-28 04:37:46 UTC
  • mto: (779.7.3 devel)
  • mto: This revision was merged to the branch mainline in revision 816.
  • Revision ID: mordred@inaugust.com-20090128043746-d2yukekishwn3ftm
TurnedĀ onĀ -Wshadow.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1076
1076
/* Factor the extern out */
1077
1077
extern const CHARSET_INFO *system_charset_info, *files_charset_info;
1078
1078
 
1079
 
void String::append_identifier(const char *name, uint32_t length)
 
1079
void String::append_identifier(const char *name, uint32_t in_length)
1080
1080
{
1081
1081
  const char *name_end;
1082
1082
  char quote_char;
1087
1087
   it's a keyword
1088
1088
  */
1089
1089
 
1090
 
  reserve(length*2 + 2);
 
1090
  reserve(in_length*2 + 2);
1091
1091
  quote_char= (char) q;
1092
1092
  append(&quote_char, 1, system_charset_info);
1093
1093
 
1094
 
  for (name_end= name+length ; name < name_end ; name+= length)
 
1094
  for (name_end= name+in_length ; name < name_end ; name+= in_length)
1095
1095
  {
1096
1096
    unsigned char chr= (unsigned char) *name;
1097
 
    length= my_mbcharlen(system_charset_info, chr);
 
1097
    in_length= my_mbcharlen(system_charset_info, chr);
1098
1098
    /*
1099
1099
      my_mbcharlen can return 0 on a wrong multibyte
1100
1100
      sequence. It is possible when upgrading from 4.0,
1102
1102
      The manual says it does not work. So we'll just
1103
1103
      change length to 1 not to hang in the endless loop.
1104
1104
    */
1105
 
    if (!length)
1106
 
      length= 1;
1107
 
    if (length == 1 && chr == (unsigned char) quote_char)
 
1105
    if (!in_length)
 
1106
      in_length= 1;
 
1107
    if (in_length == 1 && chr == (unsigned char) quote_char)
1108
1108
      append(&quote_char, 1, system_charset_info);
1109
 
    append(name, length, system_charset_info);
 
1109
    append(name, in_length, system_charset_info);
1110
1110
  }
1111
1111
  append(&quote_char, 1, system_charset_info);
1112
1112
}