summaryrefslogtreecommitdiff
path: root/heap
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
commitf78bbc8c77fa6ce325d965c4b769eed96879747b (patch)
treec7d296d78817781f8a0bdd6d65ced41030de842c /heap
parentf654bd77476caa5eec8a294a346eaa067d645a48 (diff)
downloadmariadb-git-f78bbc8c77fa6ce325d965c4b769eed96879747b.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 'heap')
-rw-r--r--heap/hp_hash.c67
1 files changed, 37 insertions, 30 deletions
diff --git a/heap/hp_hash.c b/heap/hp_hash.c
index 8feae19a480..71eecc8bdf2 100644
--- a/heap/hp_hash.c
+++ b/heap/hp_hash.c
@@ -246,12 +246,12 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
if (seg->type == HA_KEYTYPE_TEXT)
{
CHARSET_INFO *cs= seg->charset;
- uint length= ((uchar*)key) - pos;
- uint char_length= length / cs->mbmaxlen;
- if (length > char_length)
+ uint char_length= (uint) ((uchar*) key - pos);
+ if (cs->mbmaxlen > 1)
{
- char_length= my_charpos(cs, pos, pos + length, char_length);
- set_if_smaller(char_length, length);
+ uint length= char_length;
+ char_length= my_charpos(cs, pos, pos + length, length/cs->mbmaxlen);
+ set_if_smaller(char_length, length); /* QQ: ok to remove? */
}
cs->coll->hash_sort(cs, pos, char_length, &nr, &nr2);
}
@@ -289,11 +289,12 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
if (seg->type == HA_KEYTYPE_TEXT)
{
CHARSET_INFO *cs= seg->charset;
- uint char_length= seg->length / cs->mbmaxlen;
- if (seg->length > char_length)
+ uint char_length= seg->length;
+ if (cs->mbmaxlen > 1)
{
- char_length= my_charpos(cs, pos, pos + seg->length, char_length);
- set_if_smaller(char_length, seg->length);
+ char_length= my_charpos(cs, pos, pos + char_length,
+ char_length / cs->mbmaxlen);
+ set_if_smaller(char_length, seg->length); /* QQ: ok to remove? */
}
cs->coll->hash_sort(cs, pos, char_length, &nr, &nr2);
}
@@ -417,17 +418,17 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2)
if (seg->type == HA_KEYTYPE_TEXT)
{
CHARSET_INFO *cs= seg->charset;
- uint char_length= seg->length / cs->mbmaxlen;
uint char_length1;
uint char_length2;
uchar *pos1= (uchar*)rec1 + seg->start;
uchar *pos2= (uchar*)rec2 + seg->start;
- if (seg->length > char_length)
+ if (cs->mbmaxlen > 1)
{
+ uint char_length= seg->length / cs->mbmaxlen;
char_length1= my_charpos(cs, pos1, pos1 + seg->length, char_length);
- set_if_smaller(char_length1, seg->length);
+ set_if_smaller(char_length1, seg->length); /* QQ: ok to remove? */
char_length2= my_charpos(cs, pos2, pos2 + seg->length, char_length);
- set_if_smaller(char_length2, seg->length);
+ set_if_smaller(char_length2, seg->length); /* QQ: ok to remove? */
}
else
{
@@ -468,12 +469,12 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key)
if (seg->type == HA_KEYTYPE_TEXT)
{
CHARSET_INFO *cs= seg->charset;
- uint char_length= seg->length / cs->mbmaxlen;
uint char_length_key;
uint char_length_rec;
uchar *pos= (uchar*) rec + seg->start;
- if (seg->length > char_length)
+ if (cs->mbmaxlen > 1)
{
+ uint char_length= seg->length / cs->mbmaxlen;
char_length_key= my_charpos(cs, key, key + seg->length, char_length);
set_if_smaller(char_length_key, seg->length);
char_length_rec= my_charpos(cs, pos, pos + seg->length, char_length);
@@ -509,21 +510,22 @@ void hp_make_key(HP_KEYDEF *keydef, byte *key, const byte *rec)
for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++)
{
CHARSET_INFO *cs= seg->charset;
- uint char_length= (cs && cs->mbmaxlen > 1) ? seg->length / cs->mbmaxlen :
- seg->length;
+ uint char_length= seg->length;
uchar *pos= (uchar*) rec + seg->start;
if (seg->null_bit)
*key++= test(rec[seg->null_pos] & seg->null_bit);
- if (seg->length > char_length)
+ if (cs->mbmaxlen > 1)
{
- char_length= my_charpos(cs, pos, pos + seg->length, char_length);
- set_if_smaller(char_length, seg->length);
+ char_length= my_charpos(cs, pos, pos + seg->length,
+ char_length / cs->mbmaxlen);
+ set_if_smaller(char_length, seg->length); /* QQ: ok to remove? */
}
memcpy(key,rec+seg->start,(size_t) char_length);
key+= char_length;
}
}
+
uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
const byte *rec, byte *recpos)
{
@@ -575,13 +577,13 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
}
continue;
}
- char_length= seg->length / (seg->charset ? seg->charset->mbmaxlen : 1);
- if (seg->length > char_length)
+ char_length= seg->length;
+ if (seg->charset->mbmaxlen > 1)
{
char_length= my_charpos(seg->charset,
- rec + seg->start, rec + seg->start + seg->length,
- char_length);
- set_if_smaller(char_length, seg->length);
+ rec + seg->start, rec + seg->start + char_length,
+ char_length / seg->charset->mbmaxlen);
+ set_if_smaller(char_length, seg->length); /* QQ: ok to remove? */
if (char_length < seg->length)
seg->charset->cset->fill(seg->charset, key + char_length,
seg->length - char_length, ' ');
@@ -593,7 +595,9 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
return key - start_key;
}
-uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, uint k_len)
+
+uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old,
+ uint k_len)
{
HA_KEYSEG *seg, *endseg;
uchar *start_key= key;
@@ -623,11 +627,12 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, uint k_len)
}
continue;
}
- char_length= seg->length / (seg->charset ? seg->charset->mbmaxlen : 1);
- if (seg->length > char_length)
+ char_length= seg->length;
+ if (seg->charset->mbmaxlen > 1)
{
- char_length= my_charpos(seg->charset, old, old+seg->length, char_length);
- set_if_smaller(char_length, seg->length);
+ char_length= my_charpos(seg->charset, old, old+char_length,
+ char_length / seg->charset->mbmaxlen);
+ set_if_smaller(char_length, seg->length); /* QQ: ok to remove? */
if (char_length < seg->length)
seg->charset->cset->fill(seg->charset, key + char_length,
seg->length - char_length, ' ');
@@ -639,12 +644,14 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, uint k_len)
return key - start_key;
}
+
uint hp_rb_key_length(HP_KEYDEF *keydef,
const byte *key __attribute__((unused)))
{
return keydef->length;
}
+
uint hp_rb_null_key_length(HP_KEYDEF *keydef, const byte *key)
{
const byte *start_key= key;