diff options
author | monty@mishka.local <> | 2004-12-22 13:54:39 +0200 |
---|---|---|
committer | monty@mishka.local <> | 2004-12-22 13:54:39 +0200 |
commit | 4f4bbfc279800923299df1fefeb2fcd299fcde90 (patch) | |
tree | 8e5f08b17957f896c2d4e931e60b57d99c260ed6 /sql/strfunc.cc | |
parent | 198dc7a8ec6e220c348bb47e59a2ac7532be18b8 (diff) | |
parent | 98f2a83539735f1a69680195290adcf02861f073 (diff) | |
download | mariadb-git-4f4bbfc279800923299df1fefeb2fcd299fcde90.tar.gz |
Merge with 4.1
Diffstat (limited to 'sql/strfunc.cc')
-rw-r--r-- | sql/strfunc.cc | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/sql/strfunc.cc b/sql/strfunc.cc index 2253f48e558..777b3851294 100644 --- a/sql/strfunc.cc +++ b/sql/strfunc.cc @@ -53,8 +53,22 @@ ulonglong find_set(TYPELIB *lib, const char *str, uint length, CHARSET_INFO *cs, { const char *pos= start; uint var_len; + int mblen= 1; - for (; pos != end && *pos != field_separator; pos++) ; + if (cs && cs->mbminlen > 1) + { + for ( ; pos < end; pos+= mblen) + { + my_wc_t wc; + if ((mblen= cs->cset->mb_wc(cs, &wc, (const uchar *) pos, + (const uchar *) end)) < 1) + mblen= 1; // Not to hang on a wrong multibyte sequence + if (wc == (my_wc_t) field_separator) + break; + } + } + else + for (; pos != end && *pos != field_separator; pos++) ; var_len= (uint) (pos - start); uint find= cs ? find_type2(lib, start, var_len, cs) : find_type(lib, start, var_len, (bool) 0); @@ -66,9 +80,9 @@ ulonglong find_set(TYPELIB *lib, const char *str, uint length, CHARSET_INFO *cs, } else found|= ((longlong) 1 << (find - 1)); - if (pos == end) + if (pos >= end) break; - start= pos + 1; + start= pos + mblen; } } return found; |