From ad4fcb8a01f297f914e9e75d44b04e10fd91eb97 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 2 Mar 2002 09:51:24 +0200 Subject: Fix sorting of NULL values (Should always be first) Fix problem with HAVING and MAX() IS NOT NULL Docs/manual.texi: Changelog & NULL usage with ORDER BY client/mysqldump.c: Cleanup disable keys mysql-test/r/distinct.result: Fix results after ORDER BY with NULL fix mysql-test/r/group_by.result: Fix results after ORDER BY with NULL fix mysql-test/r/having.result: Testcase for bug with HAVING mysql-test/t/distinct.test: Test for DISTINCT + ORDER BY DESC bug mysql-test/t/having.test: Test of HAVING and MAX IS NOT NULL sql/filesort.cc: Fix sorting of NULL values (Should always be first) sql/item.h: Fix problem with HAVING and MAX() IS NOT NULL sql/item_sum.h: Fix problem with HAVING and MAX() IS NOT NULL sql/opt_range.cc: Fix problem with HAVING and MAX() IS NOT NULL sql/opt_range.h: Fix sorting of NULL values sql/sql_select.cc: Fix sorting of ORDER BY ... DESC on NULL values. --- client/mysqldump.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'client') diff --git a/client/mysqldump.c b/client/mysqldump.c index da708849992..c2e3d7dad3c 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -35,7 +35,7 @@ ** and adapted to mysqldump 05/11/01 by Jani Tolonen */ -#define DUMP_VERSION "8.22" +#define DUMP_VERSION "8.23" #include #include @@ -897,8 +897,6 @@ static uint getTableStructure(char *table, char* db) fputs(";\n", sql_file); } } - if (opt_disable_keys) - fprintf(sql_file,"\n/*!40000 ALTER TABLE %s DISABLE KEYS */;\n",table_name); if (cFlag) { strpos=strmov(strpos,") VALUES "); @@ -1023,7 +1021,7 @@ static void dumpTable(uint numFields, char *table) strxmov(strend(query), " WHERE ",where,NullS); } if (!opt_xml) - fputs("\n\n", md_result_file); + fputs("\n", md_result_file); if (mysql_query(sock, query)) { DBerror(sock, "when retrieving data from server"); @@ -1048,6 +1046,9 @@ static void dumpTable(uint numFields, char *table) return; } + if (opt_disable_keys) + fprintf(md_result_file,"/*!40000 ALTER TABLE %s DISABLE KEYS */;\n", + quote_name(table, table_buff)); if (opt_lock) fprintf(md_result_file,"LOCK TABLES %s WRITE;\n", quote_name(table,table_buff)); @@ -1207,11 +1208,11 @@ static void dumpTable(uint numFields, char *table) safe_exit(EX_CONSCHECK); return; } - if (opt_disable_keys) - fprintf(md_result_file,"\n/*!40000 ALTER TABLE %s ENABLE KEYS */;\n", - quote_name(table,table_buff)); if (opt_lock) fputs("UNLOCK TABLES;\n", md_result_file); + if (opt_disable_keys) + fprintf(md_result_file,"/*!40000 ALTER TABLE %s ENABLE KEYS */;\n", + quote_name(table,table_buff)); if (opt_autocommit) fprintf(md_result_file, "commit;\n"); mysql_free_result(res); -- cgit v1.2.1