~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/ctype-mb.cc

  • Committer: Lee Bieber
  • Date: 2010-11-08 00:56:57 UTC
  • mfrom: (1911.1.4 build)
  • Revision ID: kalebral@gmail.com-20101108005657-tvx0sxjyx29ldrh7
Merge Stewart - Fix bug 616466: auto_increment and PBMS problem - adds test case for this, can no longer reproduce the problem
Merge Stewart - fix bug 621755: blitzdb dictionary not updated after alter table
Merge Stewart - fix bug 668880: remove use of exit in archive storage engine
Merge Gustaf - replace macros functions

Show diffs side-by-side

added added

removed removed

Lines of Context:
147
147
  return (*t != *s);
148
148
}
149
149
 
150
 
 
151
150
/*
152
151
** Compare string against string with wildcard
153
152
**      0 if matched
155
154
**       1 if matched with wildcard
156
155
*/
157
156
 
158
 
#define INC_PTR(cs,A,B) A+=(my_ismbchar(cs,A,B) ? my_ismbchar(cs,A,B) : 1)
159
 
 
160
 
#define likeconv(s,A) (unsigned char) (s)->sort_order[(unsigned char) (A)]
161
 
 
 
157
inline static const char* inc_ptr(const charset_info_st *cs, const char *str, const char* str_end)
 
158
{
 
159
  return str + (my_ismbchar(cs, str, str_end) ? my_ismbchar(cs, str, str_end) : 1);
 
160
}
 
161
 
 
162
inline static int likeconv(const charset_info_st *cs, const char c) 
 
163
{
 
164
  return (unsigned char) cs->sort_order[(unsigned char) c];
 
165
}
 
166
    
162
167
int my_wildcmp_mb(const CHARSET_INFO * const cs,
163
168
                  const char *str,const char *str_end,
164
169
                  const char *wildstr,const char *wildend,
193
198
      {
194
199
        if (str == str_end)                     /* Skip one char if possible */
195
200
          return (result);
196
 
        INC_PTR(cs,str,str_end);
 
201
        inc_ptr(cs,str,str_end);
197
202
      } while (++wildstr < wildend && *wildstr == w_one);
198
203
      if (wildstr == wildend)
199
204
        break;
214
219
        {
215
220
          if (str == str_end)
216
221
            return (-1);
217
 
          INC_PTR(cs,str,str_end);
 
222
          inc_ptr(cs,str,str_end);
218
223
          continue;
219
224
        }
220
225
        break;                                  /* Not a wild character */
229
234
 
230
235
      mb=wildstr;
231
236
      mb_len= my_ismbchar(cs, wildstr, wildend);
232
 
      INC_PTR(cs,wildstr,wildend);              /* This is compared trough cmp */
 
237
      inc_ptr(cs,wildstr,wildend);              /* This is compared trough cmp */
233
238
      cmp=likeconv(cs,cmp);
234
239
      do
235
240
      {
251
256
            str++;
252
257
            break;
253
258
          }
254
 
          INC_PTR(cs,str, str_end);
 
259
          inc_ptr(cs,str, str_end);
255
260
        }
256
261
        {
257
262
          int tmp=my_wildcmp_mb(cs,str,str_end,wildstr,wildend,escape,w_one,
829
834
      {
830
835
        if (str == str_end)                     /* Skip one char if possible */
831
836
          return (result);
832
 
        INC_PTR(cs,str,str_end);
 
837
        inc_ptr(cs,str,str_end);
833
838
      } while (++wildstr < wildend && *wildstr == w_one);
834
839
      if (wildstr == wildend)
835
840
        break;
850
855
        {
851
856
          if (str == str_end)
852
857
            return (-1);
853
 
          INC_PTR(cs,str,str_end);
 
858
          inc_ptr(cs,str,str_end);
854
859
          continue;
855
860
        }
856
861
        break;                                  /* Not a wild character */
865
870
 
866
871
      mb=wildstr;
867
872
      mb_len= my_ismbchar(cs, wildstr, wildend);
868
 
      INC_PTR(cs,wildstr,wildend);              /* This is compared trough cmp */
 
873
      inc_ptr(cs,wildstr,wildend);              /* This is compared trough cmp */
869
874
      do
870
875
      {
871
876
        for (;;)
885
890
            str++;
886
891
            break;
887
892
          }
888
 
          INC_PTR(cs,str, str_end);
 
893
          inc_ptr(cs,str, str_end);
889
894
        }
890
895
        {
891
896
          int tmp=my_wildcmp_mb_bin(cs,str,str_end,wildstr,wildend,escape,w_one,w_many);