diff options
author | unknown <msvensson@msdesk.(none)> | 2005-10-06 14:40:18 +0200 |
---|---|---|
committer | unknown <msvensson@msdesk.(none)> | 2005-10-06 14:40:18 +0200 |
commit | df76450716d0550d8313f5d4afecd0e105558b5a (patch) | |
tree | 734fdb74393f521e44d3e254c283586558f54ca4 /strings | |
parent | 3c2dca475dfa91c95f2488831fafacacaf852347 (diff) | |
parent | e6ec5794f64617dda0cfdeb4bae422cff6d81950 (diff) | |
download | mariadb-git-df76450716d0550d8313f5d4afecd0e105558b5a.tar.gz |
Merge msdesk.(none):/home/msvensson/mysql-4.1
into msdesk.(none):/home/msvensson/mysql-5.0
BUILD/SETUP.sh:
Auto merged
BitKeeper/deleted/.del-ctype-cp932.c:
Auto merged
BitKeeper/deleted/.del-ctype_cp932.result:
Auto merged
BitKeeper/deleted/.del-ctype_cp932.test:
Auto merged
BitKeeper/deleted/.del-ndb_range_bounds.pl~ff7e47a35fb44c74:
Auto merged
innobase/os/os0sync.c:
Auto merged
mysql-test/r/ctype_tis620.result:
Auto merged
mysql-test/r/ctype_ucs.result:
Auto merged
mysql-test/r/ctype_utf8.result:
Auto merged
mysql-test/t/ctype_uca.test:
Auto merged
mysql-test/t/ctype_ucs.test:
Auto merged
mysql-test/t/ctype_ujis.test:
Auto merged
mysql-test/t/ctype_utf8.test:
Auto merged
sql/ha_innodb.cc:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
strings/ctype-big5.c:
Auto merged
strings/ctype-gbk.c:
Auto merged
strings/ctype-simple.c:
Auto merged
strings/ctype-sjis.c:
Auto merged
strings/ctype-ucs2.c:
Auto merged
client/mysql.cc:
Sam change in both 4.1 and 5.0
mysql-test/r/ctype_uca.result:
Merge
mysql-test/r/ctype_ujis.result:
Merge
strings/ctype-mb.c:
Merge
strings/ctype-tis620.c:
Merge
Diffstat (limited to 'strings')
-rw-r--r-- | strings/ctype-big5.c | 15 | ||||
-rw-r--r-- | strings/ctype-gbk.c | 15 | ||||
-rw-r--r-- | strings/ctype-mb.c | 11 | ||||
-rw-r--r-- | strings/ctype-simple.c | 11 | ||||
-rw-r--r-- | strings/ctype-sjis.c | 11 | ||||
-rw-r--r-- | strings/ctype-tis620.c | 77 | ||||
-rw-r--r-- | strings/ctype-ucs2.c | 6 |
7 files changed, 32 insertions, 114 deletions
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index 5069a1dc082..8b50388e4ef 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -401,16 +401,12 @@ static my_bool my_like_range_big5(CHARSET_INFO *cs __attribute__((unused)), uint res_length, char *min_str,char *max_str, uint *min_length,uint *max_length) { - const char *end; + const char *end= ptr + ptr_length; char *min_org=min_str; char *min_end=min_str+res_length; - uint charlen= my_charpos(cs, ptr, ptr+ptr_length, res_length/cs->mbmaxlen); + uint charlen= res_length / cs->mbmaxlen; - if (charlen < ptr_length) - ptr_length= charlen; - end= ptr + ptr_length; - - for (; ptr != end && min_str != min_end ; ptr++) + for (; ptr != end && min_str != min_end && charlen > 0; ptr++, charlen--) { if (ptr+1 != end && isbig5code(ptr[0],ptr[1])) { @@ -421,7 +417,10 @@ static my_bool my_like_range_big5(CHARSET_INFO *cs __attribute__((unused)), if (*ptr == escape && ptr+1 != end) { ptr++; /* Skip escape */ - *min_str++= *max_str++ = *ptr; + if (isbig5code(ptr[0], ptr[1])) + *min_str++= *max_str++ = *ptr++; + if (min_str < min_end) + *min_str++= *max_str++= *ptr; continue; } if (*ptr == w_one) /* '_' in SQL */ diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c index 5c220a285dd..e3a76359eaa 100644 --- a/strings/ctype-gbk.c +++ b/strings/ctype-gbk.c @@ -2714,16 +2714,12 @@ static my_bool my_like_range_gbk(CHARSET_INFO *cs __attribute__((unused)), uint res_length, char *min_str,char *max_str, uint *min_length,uint *max_length) { - const char *end; + const char *end= ptr + ptr_length; char *min_org=min_str; char *min_end=min_str+res_length; - uint charlen= my_charpos(cs, ptr, ptr+ptr_length, res_length/cs->mbmaxlen); + uint charlen= res_length / cs->mbmaxlen; - if (charlen < ptr_length) - ptr_length= charlen; - end= ptr + ptr_length; - - for (; ptr != end && min_str != min_end ; ptr++) + for (; ptr != end && min_str != min_end && charlen > 0; ptr++, charlen--) { if (ptr+1 != end && isgbkcode(ptr[0],ptr[1])) { @@ -2734,7 +2730,10 @@ static my_bool my_like_range_gbk(CHARSET_INFO *cs __attribute__((unused)), if (*ptr == escape && ptr+1 != end) { ptr++; /* Skip escape */ - *min_str++= *max_str++ = *ptr; + if (isgbkcode(ptr[0], ptr[1])) + *min_str++= *max_str++ = *ptr; + if (min_str < min_end) + *min_str++= *max_str++= *ptr; continue; } if (*ptr == w_one) /* '_' in SQL */ diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c index 6f171c03845..a3e10ba7650 100644 --- a/strings/ctype-mb.c +++ b/strings/ctype-mb.c @@ -523,17 +523,13 @@ my_bool my_like_range_mb(CHARSET_INFO *cs, char *min_str,char *max_str, uint *min_length,uint *max_length) { - const char *end; + 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= my_charpos(cs, ptr, ptr+ptr_length, res_length/cs->mbmaxlen); + uint charlen= res_length / cs->mbmaxlen; - if (charlen < ptr_length) - ptr_length= charlen; - end= ptr + ptr_length; - - for (; ptr != end && min_str != min_end ; ptr++) + for (; ptr != end && min_str != min_end && charlen > 0 ; ptr++, charlen--) { if (*ptr == escape && ptr+1 != end) { @@ -567,6 +563,7 @@ my_bool my_like_range_mb(CHARSET_INFO *cs, representation of the max_sort_char character, and copy it into max_str in a loop. */ + *max_length= res_length; pad_max_char(cs, max_str, max_end); return 0; } diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index 208c38edd30..d25b9e4d9cf 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -1034,17 +1034,12 @@ my_bool my_like_range_simple(CHARSET_INFO *cs, char *min_str,char *max_str, uint *min_length,uint *max_length) { - const char *end; + const char *end= ptr + ptr_length; char *min_org=min_str; char *min_end=min_str+res_length; -#ifdef USE_MB - uint charlen= my_charpos(cs, ptr, ptr+ptr_length, res_length/cs->mbmaxlen); - if (charlen < ptr_length) - ptr_length= charlen; -#endif - end= ptr + ptr_length; + uint charlen= res_length / cs->mbmaxlen; - for (; ptr != end && min_str != min_end ; ptr++) + for (; ptr != end && min_str != min_end && charlen > 0 ; ptr++, charlen--) { if (*ptr == escape && ptr+1 != end) { diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index c0a395b5792..2ed21a40edd 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -330,16 +330,13 @@ static my_bool my_like_range_sjis(CHARSET_INFO *cs __attribute__((unused)), uint res_length, char *min_str,char *max_str, uint *min_length,uint *max_length) { - const char *end; + const char *end= ptr + ptr_length; char *min_org=min_str; char *min_end=min_str+res_length; - uint charlen= my_charpos(cs, ptr, ptr+ptr_length, res_length/cs->mbmaxlen); + uint charlen= res_length / cs->mbmaxlen; - if (charlen < ptr_length) - ptr_length= charlen; - end= ptr + ptr_length; - - while (ptr < end && min_str < min_end) { + for ( ; ptr < end && min_str < min_end && charlen > 0 ; charlen--) + { if (ismbchar_sjis(cs, ptr, end)) { *min_str++ = *max_str++ = *ptr++; if (min_str < min_end) diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index 2003eaa0789..762f6d2dfb6 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -648,77 +648,6 @@ int my_strnxfrm_tis620(CHARSET_INFO *cs __attribute__((unused)), } - -/* - Convert SQL LIKE string to C string - - Arg: String, its length, escape character, resource length, - minimal string and maximum string - Ret: Always 0 - - IMPLEMENTATION - We just copy this function from opt_range.cc. No need to convert to - thai2sortable string. min_str and max_str will be use for comparison and - converted there. - - RETURN VALUES - 0 -*/ - -#define max_sort_chr ((char) 255) - -static -my_bool my_like_range_tis620(CHARSET_INFO *cs __attribute__((unused)), - const char *ptr, uint ptr_length, - pbool escape, pbool w_one, pbool w_many, - uint res_length, char *min_str, char *max_str, - uint *min_length, uint *max_length) -{ - const char *end=ptr+ptr_length; - char *min_org=min_str; - char *min_end=min_str+res_length; - - for (; ptr != end && min_str != min_end ; ptr++) - { - if (*ptr == escape && ptr+1 != end) - { - ptr++; /* Skip escape */ - *min_str++ = *max_str++ = *ptr; - continue; - } - if (*ptr == w_one) /* '_' in SQL */ - { - *min_str++='\0'; /* This should be min char */ - *max_str++=max_sort_chr; - continue; - } - if (*ptr == w_many) /* '%' in SQL */ - { - /* - Calculate length of keys: - 'a\0\0... is the smallest possible string when we have space expand - a\ff\ff... is the biggest possible string - */ - *min_length= ((cs->state & MY_CS_BINSORT) ? (uint) (min_str - min_org) : - res_length); - *max_length= res_length; - do - { - *min_str++ = 0; - *max_str++ = max_sort_chr; - } while (min_str != min_end); - return 0; - } - *min_str++= *max_str++ = *ptr; - } - - *min_length= *max_length = (uint) (min_str - min_org); - while (min_str != min_end) - *min_str++= *max_str++ = ' '; /* Because of key compression */ - return 0; -} - - static unsigned short cs_to_uni[256]={ 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, @@ -928,7 +857,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler = my_strnncollsp_tis620, my_strnxfrm_tis620, my_strnxfrmlen_simple, - my_like_range_tis620, + my_like_range_simple, my_wildcmp_8bit, /* wildcmp */ my_strcasecmp_8bit, my_instr_simple, /* QQ: To be fixed */ @@ -992,7 +921,7 @@ CHARSET_INFO my_charset_tis620_thai_ci= 1, /* mbminlen */ 1, /* mbmaxlen */ 0, /* min_sort_char */ - 0, /* max_sort_char */ + 255, /* max_sort_char */ 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, &my_collation_ci_handler @@ -1023,7 +952,7 @@ CHARSET_INFO my_charset_tis620_bin= 1, /* mbminlen */ 1, /* mbmaxlen */ 0, /* min_sort_char */ - 0, /* max_sort_char */ + 255, /* max_sort_char */ 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, &my_collation_8bit_bin_handler diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index 41ab055d2de..c389f2e7f75 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1450,10 +1450,12 @@ my_bool my_like_range_ucs2(CHARSET_INFO *cs, const char *end=ptr+ptr_length; char *min_org=min_str; char *min_end=min_str+res_length; + uint charlen= res_length / cs->mbmaxlen; - for (; ptr + 1 < end && min_str + 1 < min_end ; ptr+=2) + for ( ; ptr + 1 < end && min_str + 1 < min_end && charlen > 0 + ; ptr+=2, charlen--) { - if (ptr[0] == '\0' && ptr[1] == escape && ptr+2 < end) + if (ptr[0] == '\0' && ptr[1] == escape && ptr + 1 < end) { ptr+=2; /* Skip escape */ *min_str++= *max_str++ = ptr[0]; |