~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.cc

  • Committer: Olaf van der Spek
  • Date: 2011-10-24 15:58:22 UTC
  • mto: This revision was merged to the branch mainline in revision 2449.
  • Revision ID: olafvdspek@gmail.com-20111024155822-t0k04ojblkqf8v6z
Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
1160
1160
          escape_char != -1)
1161
1161
      {
1162
1162
        char *pos, *start, *end;
1163
 
        const charset_info_st * const res_charset= res->charset();
1164
 
        const charset_info_st * const character_set_client= default_charset_info;
 
1163
        const charset_info_st* const res_charset= res->charset();
1165
1164
 
1166
 
        bool check_second_byte= false;
1167
 
        assert(character_set_client->mbmaxlen == 2 || not false);
1168
 
        for (start=pos=(char*) res->ptr(),end=pos+used_length ;
1169
 
             pos != end ;
1170
 
             pos++)
 
1165
        for (start= pos= (char*) res->ptr(),end=pos+used_length; pos != end; pos++)
1171
1166
        {
1172
1167
          if (use_mb(res_charset))
1173
1168
          {
1174
 
            int l;
1175
 
            if ((l=my_ismbchar(res_charset, pos, end)))
 
1169
            if (int l= my_ismbchar(res_charset, pos, end))
1176
1170
            {
1177
 
              pos += l-1;
 
1171
              pos += l - 1;
1178
1172
              continue;
1179
1173
            }
1180
1174
          }
1211
1205
            assert before the loop makes that sure.
1212
1206
          */
1213
1207
 
1214
 
          if ((needs_escaping(*pos, enclosed) ||
1215
 
               (check_second_byte &&
1216
 
                my_mbcharlen(character_set_client, (unsigned char) *pos) == 2 &&
1217
 
                pos + 1 < end &&
1218
 
                needs_escaping(pos[1], enclosed))) &&
 
1208
          if (needs_escaping(*pos, enclosed) &&
1219
1209
              /*
1220
1210
                Don't escape field_term_char by doubling - doubling is only
1221
1211
                valid for ENCLOSED BY characters:
1225
1215
          {
1226
1216
            char tmp_buff[2];
1227
1217
            tmp_buff[0]= ((int) (unsigned char) *pos == field_sep_char &&
1228
 
                          is_ambiguous_field_sep) ?
1229
 
              field_sep_char : escape_char;
 
1218
                          is_ambiguous_field_sep) ? field_sep_char : escape_char;
1230
1219
            tmp_buff[1]= *pos ? *pos : '0';
1231
1220
            if (cache->write(start, pos - start) || cache->write(tmp_buff, 2))
1232
1221
              return true;