diff options
author | unknown <igor@olga.mysql.com> | 2007-01-30 13:14:52 -0800 |
---|---|---|
committer | unknown <igor@olga.mysql.com> | 2007-01-30 13:14:52 -0800 |
commit | 309f2a606baa2447ca902e01e909a878fcae45e9 (patch) | |
tree | db588e6b6deebacd8515f72e9897a1546a2c7eca /sql | |
parent | 1495924319c1b6fab0261a7206e872f43f0c4857 (diff) | |
parent | 1944b4ca01165d34b2e0d5449704587129045684 (diff) | |
download | mariadb-git-309f2a606baa2447ca902e01e909a878fcae45e9.tar.gz |
Merge olga.mysql.com:/home/igor/dev-opt/mysql-4.1-opt-bug24987
into olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug24987
sql/opt_sum.cc:
Auto merged
sql/sql_select.cc:
Manual merge
Diffstat (limited to 'sql')
-rw-r--r-- | sql/opt_sum.cc | 10 | ||||
-rw-r--r-- | sql/sql_select.cc | 20 |
2 files changed, 16 insertions, 14 deletions
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index e8bc15a93f1..9222e15ff91 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -67,9 +67,9 @@ static int maxmin_in_range(bool max_fl, Field* field, COND *cond); GROUP BY part. RETURN VALUES - 0 No errors - 1 if all items were resolved - -1 on impossible conditions + 0 no errors + 1 if all items were resolved + HA_ERR_KEY_NOT_FOUND on impossible conditions OR an error number from my_base.h HA_ERR_... if a deadlock or a lock wait timeout happens, for example */ @@ -224,7 +224,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) if (error) { if (error == HA_ERR_KEY_NOT_FOUND || error == HA_ERR_END_OF_FILE) - return -1; // No rows matching WHERE + return HA_ERR_KEY_NOT_FOUND; // No rows matching WHERE /* HA_ERR_LOCK_DEADLOCK or some other error */ table->file->print_error(error, MYF(0)); return(error); @@ -311,7 +311,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds) if (error) { if (error == HA_ERR_KEY_NOT_FOUND || error == HA_ERR_END_OF_FILE) - return -1; // No rows matching WHERE + return HA_ERR_KEY_NOT_FOUND; // No rows matching WHERE /* HA_ERR_LOCK_DEADLOCK or some other error */ table->file->print_error(error, MYF(0)); return(error); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index c445c6f5312..2c7d6bf65ce 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -707,11 +707,20 @@ JOIN::optimize() { int res; /* - opt_sum_query() returns -1 if no rows match to the WHERE conditions, - or 1 if all items were resolved, or 0, or an error number HA_ERR_... + opt_sum_query() returns HA_ERR_KEY_NOT_FOUND if no rows match + to the WHERE conditions, + or 1 if all items were resolved, + or 0, or an error number HA_ERR_... */ if ((res=opt_sum_query(select_lex->leaf_tables, all_fields, conds))) { + if (res == HA_ERR_KEY_NOT_FOUND) + { + DBUG_PRINT("info",("No matching min/max row")); + zero_result_cause= "No matching min/max row"; + error=0; + DBUG_RETURN(0); + } if (res > 1) { thd->fatal_error(); @@ -719,13 +728,6 @@ JOIN::optimize() DBUG_PRINT("error",("Error from opt_sum_query")); DBUG_RETURN(1); } - if (res < 0) - { - DBUG_PRINT("info",("No matching min/max row")); - zero_result_cause= "No matching min/max row"; - error=0; - DBUG_RETURN(0); - } DBUG_PRINT("info",("Select tables optimized away")); zero_result_cause= "Select tables optimized away"; tables_list= 0; // All tables resolved |