diff options
author | unknown <monty@mysql.com> | 2004-03-25 15:05:01 +0200 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-03-25 15:05:01 +0200 |
commit | 3c46af6cf4e935683e5288c55f8b4ff4badaa553 (patch) | |
tree | 27e5290a14e7d3e6c7aaced5b2ce86546de4721e /sql | |
parent | 2d20eddcbbfdac3403313f860464937d4250eb8e (diff) | |
download | mariadb-git-3c46af6cf4e935683e5288c55f8b4ff4badaa553.tar.gz |
BTREE-indexes in HEAP tables can now be used to optimize ORDER BY
Don't read character set files if we are using only the default charset. In most cases the user will not anymore get a warning about missing character set files
Compare strings with space extend instead of space strip. Now the following comparisons holds: "a" == "a " and "a\t" < "a". (Bug #3152).
Note: Because of the above fix, one has to do a REPAIR on any table that has an ascii character < 32 last in a CHAR/VARCHAR/TEXT columns.
heap/hp_hash.c:
Comments and DBUG information
include/my_handler.h:
Updated prototype for mi_compare_text
myisam/ft_boolean_search.c:
Updated calls to mi_compare_text
myisam/ft_nlq_search.c:
Updated calls to mi_compare_text
myisam/ft_parser.c:
Updated calls to mi_compare_text
myisam/ft_stopwords.c:
Updated calls to mi_compare_text
myisam/ft_update.c:
Updated calls to mi_compare_text
myisam/mi_check.c:
Updated calls to mi_compare_text
myisam/mi_search.c:
Changed all string comparisons that removed end space to instead extend the shorter string with space
myisam/mi_unique.c:
Updated calls to mi_compare_text
myisam/mi_write.c:
Updated calls to mi_compare_text
myisam/myisam_ftdump.c:
Removed compiler warning
mysql-test/r/ctype_collate.result:
Fixed wrong result
mysql-test/r/heap_btree.result:
More tests
mysql-test/t/heap_btree.test:
more tests
mysys/charset.c:
Don't read charsets if we are only using default charset
Don't require 'init_available_charsets' to succeed.
mysys/my_handler.c:
Compare strings with space extend instead of space strip
mysys/tree.c:
Fixed code to get better results for range optimzier
sql/field.cc:
Compare strings with space extend instead of space strip
sql/filesort.cc:
Compare strings with space extend instead of space strip
sql/ha_heap.cc:
Created bit map for keys that are using BTREE. This allows the optimzer to use BTREE's for sorting
sql/ha_heap.h:
Created bit map for keys that are using BTREE. This allows the optimzer to use BTREE's for sorting
strings/ctype-big5.c:
Compare strings with space extend instead of space strip
strings/ctype-czech.c:
Indentation cleanup. Should be fixed to use space extend
strings/ctype-gbk.c:
Compare strings with space extend instead of space strip
strings/ctype-latin1.c:
Compare strings with space extend instead of space strip
Added missing my_hash_sort_latin1_de function
strings/ctype-mb.c:
For binary strings, don't remove end space when comparing
strings/ctype-simple.c:
Compare strings with space extend instead of space strip
strings/ctype-sjis.c:
Compare strings with space extend instead of space strip
strings/ctype-tis620.c:
Added comments that we should fix end space handling
strings/ctype-ucs2.c:
indentation fixes
strings/ctype-utf8.c:
Added comments that we should fix end space handling
strings/ctype-win1250ch.c:
Added comments that we should fix end space handling
Diffstat (limited to 'sql')
-rw-r--r-- | sql/field.cc | 13 | ||||
-rw-r--r-- | sql/filesort.cc | 10 | ||||
-rw-r--r-- | sql/ha_heap.cc | 10 | ||||
-rw-r--r-- | sql/ha_heap.h | 2 |
4 files changed, 27 insertions, 8 deletions
diff --git a/sql/field.cc b/sql/field.cc index 00b7b9ebdb9..574800b6180 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -4209,10 +4209,10 @@ int Field_string::cmp(const char *a_ptr, const char *b_ptr) void Field_string::sort_string(char *to,uint length) { uint tmp=my_strnxfrm(field_charset, - (unsigned char *)to, length, - (unsigned char *) ptr, field_length); + (unsigned char *) to, length, + (unsigned char *) ptr, field_length); if (tmp < length) - bzero(to + tmp, length - tmp); + field_charset->cset->fill(field_charset, to + tmp, length - tmp, ' '); } @@ -4384,7 +4384,8 @@ void Field_varstring::sort_string(char *to,uint length) (unsigned char *) to, length, (unsigned char *)ptr+2, tot_length); if (tot_length < length) - bzero(to+tot_length,length-tot_length); + field_charset->cset->fill(field_charset, to+tot_length,length-tot_length, + binary() ? (char) 0 : ' '); } @@ -4838,7 +4839,9 @@ void Field_blob::sort_string(char *to,uint length) (unsigned char *)to, length, (unsigned char *)blob, blob_length); if (blob_length < length) - bzero(to+blob_length, length-blob_length); + field_charset->cset->fill(field_charset, to+blob_length, + length-blob_length, + binary() ? (char) 0 : ' '); } } diff --git a/sql/filesort.cc b/sql/filesort.cc index 064e92b7888..a15ffb43f6f 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -528,6 +528,8 @@ static void make_sortkey(register SORTPARAM *param, case STRING_RESULT: { CHARSET_INFO *cs=item->collation.collation; + char fill_char= ((cs->state & MY_CS_BINSORT) ? (char) 0 : ' '); + if ((maybe_null=item->maybe_null)) *to++=1; /* All item->str() to use some extra byte for end null.. */ @@ -564,14 +566,16 @@ static void make_sortkey(register SORTPARAM *param, uint tmp_length=my_strnxfrm(cs,to,sort_field->length, (unsigned char *) from, length); if (tmp_length < sort_field->length) - bzero((char*) to+tmp_length,sort_field->length-tmp_length); + cs->cset->fill(cs, (char*) to+tmp_length, + sort_field->length-tmp_length, + fill_char); } else { my_strnxfrm(cs,(uchar*)to,length,(const uchar*)res->ptr(),length); - bzero((char *)to+length,diff); + cs->cset->fill(cs, (char *)to+length,diff,fill_char); } - break; + break; } case INT_RESULT: { diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc index 807b6e35a29..c84f0da0d25 100644 --- a/sql/ha_heap.cc +++ b/sql/ha_heap.cc @@ -44,6 +44,16 @@ int ha_heap::open(const char *name, int mode, uint test_if_locked) } } ref_length= sizeof(HEAP_PTR); + if (file) + { + /* Initialize variables for the opened table */ + btree_keys.clear_all(); + for (uint i= 0 ; i < table->keys ; i++) + { + if (table->key_info[i].algorithm == HA_KEY_ALG_BTREE) + btree_keys.set_bit(i); + } + } return (file ? 0 : 1); } diff --git a/sql/ha_heap.h b/sql/ha_heap.h index c369c7029b4..feadc0c3c0f 100644 --- a/sql/ha_heap.h +++ b/sql/ha_heap.h @@ -26,6 +26,7 @@ class ha_heap: public handler { HP_INFO *file; + key_map btree_keys; public: ha_heap(TABLE *table): handler(table), file(0) {} @@ -49,6 +50,7 @@ class ha_heap: public handler (HA_ONLY_WHOLE_INDEX | HA_WRONG_ASCII_ORDER | HA_NOT_READ_PREFIX_LAST)); } + const key_map *keys_to_use_for_scanning() { return &btree_keys; } uint max_record_length() const { return HA_MAX_REC_LENGTH; } uint max_keys() const { return MAX_KEY; } uint max_key_parts() const { return MAX_REF_PARTS; } |