diff options
author | unknown <monty@mashka.mysql.fi> | 2002-09-16 15:55:19 +0300 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2002-09-16 15:55:19 +0300 |
commit | 9ce6267ebe0089e8f327bb609cacd5cda1ed8617 (patch) | |
tree | af207b8432596b36633c5f65e7f268ea2b076d6f /sql/filesort.cc | |
parent | bdf11b22cd43d07daac9a80712c1c1fc93b60a23 (diff) | |
download | mariadb-git-9ce6267ebe0089e8f327bb609cacd5cda1ed8617.tar.gz |
Added CREATE TEMPORARY TABLES and LOCK TABLES to db and host tables
Fixed bug in SELECT ... ORDER BY ... LIMIT
Fixed bug in ALTER TABLE and RENAME TABLE with --lower-case-table-names
Fixed hang when using --with-openssl
Docs/manual.texi:
Updated SHOW VARIABLES
Changelog
Moved some missplaced changelog entries
include/violite.h:
updated prototypes
libmysqld/lib_sql.cc:
Moved init_update_queries() to sql_parse.cc
mysql-test/install_test_db.sh:
Added CREATE TEMPORARY TABLES and LOCK TABLES to db and host tables
mysql-test/r/grant.result:
Added CREATE TEMPORARY TABLES and LOCK TABLES to db and host tables
mysql-test/t/grant.test:
Added CREATE TEMPORARY TABLES and LOCK TABLES to db and host tables
scripts/mysql_fix_privilege_tables.sh:
Added CREATE TEMPORARY TABLES and LOCK TABLES to db and host tables
scripts/mysql_install_db.sh:
Added CREATE TEMPORARY TABLES and LOCK TABLES to db and host tables
sql/filesort.cc:
Fixed bug in SELECT ... ORDER BY ... LIMIT
sql/mysql_priv.h:
New prototypes
sql/mysqld.cc:
Added CREATE TEMPORARY TABLES and LOCK TABLES to db and host tables
sql/sql_acl.cc:
Moved init_update_queries() to sql_parse.cc
Added CREATE TEMPORARY TABLES and LOCK TABLES to db and host
sql/sql_acl.h:
Added CREATE TEMPORARY TABLES and LOCK TABLES to db and host
sql/sql_parse.cc:
Moved init_update_queries() to sql_parse.cc
sql/sql_show.cc:
Fixed wrong output in SHOW TABLE STATUS for compressed tables.
sql/sql_table.cc:
Fixed bug in ALTER TABLE and RENAME TABLE with --lower-case-table-names
vio/viosocket.c:
Fixed hang when using --with-openssl
vio/viossl.c:
Fixed hang when using --with-openssl
Diffstat (limited to 'sql/filesort.cc')
-rw-r--r-- | sql/filesort.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc index c6782aa0d93..d8fcb0292ff 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -370,13 +370,18 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select, { if (write_keys(param,sort_keys,idx,buffpek_pointers,tempfile)) DBUG_RETURN(HA_POS_ERROR); - idx=0; indexpos++; + idx=0; if (param->ref_length == param->sort_length && my_b_tell(tempfile)/param->sort_length >= param->max_rows) { + /* + We are writing the result index file and have found all + rows that we need. Abort the sort and return the result. + */ error=HA_ERR_END_OF_FILE; break; /* Found enough records */ } + indexpos++; } make_sortkey(param,sort_keys[idx++],ref_pos); } @@ -391,7 +396,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select, file->print_error(error,MYF(ME_ERROR | ME_WAITTANG)); /* purecov: inspected */ DBUG_RETURN(HA_POS_ERROR); /* purecov: inspected */ } - if (indexpos && + if (indexpos && idx && write_keys(param,sort_keys,idx,buffpek_pointers,tempfile)) DBUG_RETURN(HA_POS_ERROR); /* purecov: inspected */ DBUG_RETURN(my_b_inited(tempfile) ? @@ -759,7 +764,11 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file, } buffpek->key+=sort_length; buffpek->mem_count--; - max_rows--; + if (!--max_rows) + { + error=0; /* purecov: inspected */ + goto end; /* purecov: inspected */ + } queue_replaced(&queue); // Top element has been used } else |