diff options
author | unknown <igor@rurik.mysql.com> | 2006-06-21 20:06:33 -0700 |
---|---|---|
committer | unknown <igor@rurik.mysql.com> | 2006-06-21 20:06:33 -0700 |
commit | aec092521bb2aedf6de796516671615e7958ceba (patch) | |
tree | 25954c3b878ebaa235de23b0497b148ad5702349 /strings | |
parent | 5cb66b11363ac9acabf6c11a5d208f1e1e8aa233 (diff) | |
parent | 6a63106558b2695e60fb26033d2dfdb2116a009a (diff) | |
download | mariadb-git-aec092521bb2aedf6de796516671615e7958ceba.tar.gz |
Merge rurik.mysql.com:/home/igor/mysql-4.1-opt
into rurik.mysql.com:/home/igor/mysql-5.0-opt
mysql-test/t/ctype_utf8.test:
Auto merged
strings/ctype-mb.c:
Auto merged
mysql-test/r/ctype_utf8.result:
SCCS merged
Diffstat (limited to 'strings')
-rw-r--r-- | strings/ctype-mb.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c index a3e10ba7650..9d7aad0ca05 100644 --- a/strings/ctype-mb.c +++ b/strings/ctype-mb.c @@ -523,21 +523,19 @@ my_bool my_like_range_mb(CHARSET_INFO *cs, char *min_str,char *max_str, uint *min_length,uint *max_length) { + uint mblen; const char *end= ptr + ptr_length; char *min_org= min_str; char *min_end= min_str + res_length; char *max_end= max_str + res_length; - uint charlen= res_length / cs->mbmaxlen; + uint maxcharlen= res_length / cs->mbmaxlen; - for (; ptr != end && min_str != min_end && charlen > 0 ; ptr++, charlen--) + for (; ptr != end && min_str != min_end && maxcharlen ; maxcharlen--) { + /* We assume here that escape, w_any, w_namy are one-byte characters */ if (*ptr == escape && ptr+1 != end) - { - ptr++; /* Skip escape */ - *min_str++= *max_str++ = *ptr; - continue; - } - if (*ptr == w_one || *ptr == w_many) /* '_' and '%' in SQL */ + ptr++; /* Skip escape */ + else if (*ptr == w_one || *ptr == w_many) /* '_' and '%' in SQL */ { charlen= my_charpos(cs, min_org, min_str, res_length/cs->mbmaxlen); @@ -567,7 +565,16 @@ my_bool my_like_range_mb(CHARSET_INFO *cs, pad_max_char(cs, max_str, max_end); return 0; } - *min_str++= *max_str++ = *ptr; + if ((mblen= my_ismbchar(cs, ptr, end)) > 1) + { + if (ptr+mblen > end || min_str+mblen > min_end) + break; + while (mblen--) + *min_str++= *max_str++= *ptr++; + } + else + *min_str++= *max_str++= *ptr++; + } *min_length= *max_length = (uint) (min_str - min_org); |