diff options
author | mskold@mysql.com <> | 2005-01-21 08:43:41 +0100 |
---|---|---|
committer | mskold@mysql.com <> | 2005-01-21 08:43:41 +0100 |
commit | 7c07a2e725af936bda2e118b996f3976d4ebdc3b (patch) | |
tree | 98550be0e92e345e463c3f159d07fb888eadeabb /sql/filesort.cc | |
parent | 6bb027a97cbae873ad16c65dafd77dccbfee0c4e (diff) | |
parent | 8f2f5736047855bde0219f68915309129cd3ce26 (diff) | |
download | mariadb-git-7c07a2e725af936bda2e118b996f3976d4ebdc3b.tar.gz |
Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb
into mysql.com:/usr/local/home/marty/MySQL/test/mysql-5.0-ndb
Diffstat (limited to 'sql/filesort.cc')
-rw-r--r-- | sql/filesort.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc index 486215e51a1..21f75fa5ea0 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -564,10 +564,10 @@ write_keys(SORTPARAM *param, register uchar **sort_keys, uint count, if (!my_b_inited(tempfile) && open_cached_file(tempfile, mysql_tmpdir, TEMP_PREFIX, DISK_BUFFER_SIZE, MYF(MY_WME))) - goto err; /* purecov: inspected */ + goto err; /* purecov: inspected */ buffpek.file_pos= my_b_tell(tempfile); if ((ha_rows) count > param->max_rows) - count=(uint) param->max_rows; /* purecov: inspected */ + count=(uint) param->max_rows; /* purecov: inspected */ buffpek.count=(ha_rows) count; for (end=sort_keys+count ; sort_keys != end ; sort_keys++) if (my_b_write(tempfile, (byte*) *sort_keys, (uint) rec_length)) @@ -838,11 +838,16 @@ int merge_many_buff(SORTPARAM *param, uchar *sort_buffer, if (flush_io_cache(to_file)) break; /* purecov: inspected */ temp=from_file; from_file=to_file; to_file=temp; + setup_io_cache(from_file); + setup_io_cache(to_file); *maxbuffer= (uint) (lastbuff-buffpek)-1; } close_cached_file(to_file); // This holds old result if (to_file == t_file) + { *t_file=t_file2; // Copy result file + setup_io_cache(t_file); + } DBUG_RETURN(*maxbuffer >= MERGEBUFF2); /* Return 1 if interrupted */ } /* merge_many_buff */ @@ -1170,7 +1175,12 @@ sortlength(SORT_FIELD *sortorder, uint s_length, bool *multi_byte_charset) else { sortorder->length=sortorder->field->pack_length(); - if (use_strnxfrm((cs=sortorder->field->charset()))) + /* + We must test cmp_type() to ensure that ENUM and SET are sorted + as numbers + */ + if (use_strnxfrm((cs=sortorder->field->charset())) && + sortorder->field->cmp_type() == STRING_RESULT) { sortorder->need_strxnfrm= 1; *multi_byte_charset= 1; |