summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-08-26 18:26:38 +0300
committerunknown <monty@mysql.com>2004-08-26 18:26:38 +0300
commit44b2807e4bb2383525c3abfd9ad896114dec0796 (patch)
treec7d296d78817781f8a0bdd6d65ced41030de842c /strings
parent92dfd1bf9a3cc1b2ae720363295acf633b1e7271 (diff)
downloadmariadb-git-44b2807e4bb2383525c3abfd9ad896114dec0796.tar.gz
Portability fixes
Fixed bug in end space handle for WHERE text_column="constant" heap/hp_hash.c: Optimzations (no change of logic) libmysql/libmysql.c: Added missing casts (portability fix) myisam/mi_key.c: Changed macro to take arguments and not depend on local variables Simple indentation fixes ? mysql-test/r/connect.result: Added test for setting empty password mysql-test/r/create_select_tmp.result: TYPE -> ENGINE mysql-test/r/ctype_utf8.result: Combine drop's mysql-test/r/endspace.result: Added more tests to test end space behaviour mysql-test/r/having.result: Added missing DROP TABLE mysql-test/r/type_blob.result: Added more tests to ensure that fix for BLOB usage is correct mysql-test/r/type_timestamp.result: Add test from 4.0 mysql-test/t/connect.test: Added test for setting empty password mysql-test/t/create_select_tmp.test: TYPE -> ENGINE mysql-test/t/ctype_utf8.test: Combine drop's mysql-test/t/endspace.test: Added more tests to test end space behaviour mysql-test/t/having.test: Added missing DROP TABLE mysql-test/t/type_blob.test: Added more tests to ensure that fix for BLOB usage is correct mysql-test/t/type_timestamp.test: Add test from 4.0 sql/field.cc: Removed not used variable Portability fix (cast) Simplified Field_str::double() Simple indentation cleanups sql/field.h: Removed not needed class variable sql/item_cmpfunc.cc: Indentation fix sql/item_strfunc.cc: Use on stack variable for Item_str_func::val() instead of str_value. This makes it safe to use str_value inside the Item's val function. Cleaned up LEFT() usage, thanks to the above change sql/item_sum.cc: Indentation cleanups sql/protocol.cc: Added missing cast sql/sql_acl.cc: Indentatin cleanups. Added missing cast Simple optimization of get_sort() sql/sql_select.cc: Don't use 'ref' to search on text field that is not of type BINARY (use 'range' instead). The reson is that for 'ref' we use 'index_next_same' to read the next possible row. For text fields, rows in a ref may not come in order, like for 'x', 'x\t' 'x ' (stored in this order) which causes a search for 'column='x ' to fail sql/tztime.cc: Simple cleanup strings/ctype-bin.c: Comment fixes strings/ctype-mb.c: Changed variable names for arguments
Diffstat (limited to 'strings')
-rw-r--r--strings/ctype-bin.c5
-rw-r--r--strings/ctype-mb.c41
2 files changed, 27 insertions, 19 deletions
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c
index e759a5654f1..a33398fa6fa 100644
--- a/strings/ctype-bin.c
+++ b/strings/ctype-bin.c
@@ -93,7 +93,7 @@ static int my_strnncoll_binary(CHARSET_INFO * cs __attribute__((unused)),
NOTE
This function is used for real binary strings, i.e. for
BLOB, BINARY(N) and VARBINARY(N).
- It does not ignore trailing spaces.
+ It compares trailing spaces as spaces.
RETURN
< 0 s < t
@@ -133,7 +133,8 @@ static int my_strnncoll_8bit_bin(CHARSET_INFO * cs __attribute__((unused)),
NOTE
This function is used for character strings with binary collations.
- It ignores trailing spaces.
+ The shorter string is extended with end space to be as long as the longer
+ one.
RETURN
< 0 s < t
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c
index ecafa6356d5..34c2d887247 100644
--- a/strings/ctype-mb.c
+++ b/strings/ctype-mb.c
@@ -237,7 +237,8 @@ int my_wildcmp_mb(CHARSET_INFO *cs,
if (str++ == str_end) return (-1);
}
{
- int tmp=my_wildcmp_mb(cs,str,str_end,wildstr,wildend,escape,w_one,w_many);
+ int tmp=my_wildcmp_mb(cs,str,str_end,wildstr,wildend,escape,w_one,
+ w_many);
if (tmp <= 0)
return (tmp);
}
@@ -248,41 +249,46 @@ int my_wildcmp_mb(CHARSET_INFO *cs,
return (str != str_end ? 1 : 0);
}
+
uint my_numchars_mb(CHARSET_INFO *cs __attribute__((unused)),
- const char *b, const char *e)
+ const char *pos, const char *end)
{
- register uint32 n=0,mblen;
- while (b < e)
+ register uint32 count=0;
+ while (pos < end)
{
- b+= (mblen= my_ismbchar(cs,b,e)) ? mblen : 1;
- ++n;
+ uint mblen;
+ pos+= (mblen= my_ismbchar(cs,pos,end)) ? mblen : 1;
+ count++;
}
- return n;
+ return count;
}
+
uint my_charpos_mb(CHARSET_INFO *cs __attribute__((unused)),
- const char *b, const char *e, uint pos)
+ const char *pos, const char *end, uint length)
{
- uint mblen;
- const char *b0=b;
+ const char *start= pos;
- while (pos && b<e)
+ while (length && pos < end)
{
- b+= (mblen= my_ismbchar(cs,b,e)) ? mblen : 1;
- pos--;
+ uint mblen;
+ pos+= (mblen= my_ismbchar(cs, pos, end)) ? mblen : 1;
+ length--;
}
- return pos ? e+2-b0 : b-b0;
+ return length ? end+2-start : pos-start;
}
+
uint my_well_formed_len_mb(CHARSET_INFO *cs,
const char *b, const char *e, uint pos)
{
- my_wc_t wc;
- int mblen;
const char *b_start= b;
while (pos)
{
+ my_wc_t wc;
+ int mblen;
+
if ((mblen= cs->cset->mb_wc(cs, &wc, (uchar*) b, (uchar*) e)) <0)
break;
b+= mblen;
@@ -374,7 +380,8 @@ static int my_strnncoll_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
NOTE
This function is used for character strings with binary collations.
- It ignores trailing spaces.
+ The shorter string is extended with end space to be as long as the longer
+ one.
RETURN
A negative number if s < t