MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:igor Date:January 30 2007 9:06pm
Subject:bk commit into 4.1 tree (igor:1.2600) BUG#24987
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of igor. When igor does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-01-30 13:06:36-08:00, igor@stripped +2 -0
  Fixed bug #24987.
  Made the function opt_sum_query to return HA_ERR_KEY_NOT_FOUND when
  no matches were found (instead of -1 it returned prior this patch).
  This changes allow us to avoid possible conflicts with return values
  from user-defined handler methods which also may return -1. 
  No particular test cases are provided with this fix.

  sql/opt_sum.cc@stripped, 2007-01-30 13:06:33-08:00, igor@stripped +5 -5
    Fixed bug #24987.
    Made the function opt_sum_query to return HA_ERR_KEY_NOT_FOUND when
    no matches were found (instead of -1 it returned prior this patch).
    This changes allow us to avoid possible conflicts with return values
    from user-defined handler methods which also may return -1. 

  sql/sql_select.cc@stripped, 2007-01-30 13:06:33-08:00, igor@stripped +10 -8
    Fixed bug #24987.
    Made the function opt_sum_query to return HA_ERR_KEY_NOT_FOUND when
    no matches were found (instead of -1 it returned prior this patch).
    This changes allow us to avoid possible conflicts with return values
    from user-defined handler methods which also may return -1. 

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	igor
# Host:	olga.mysql.com
# Root:	/home/igor/dev-opt/mysql-4.1-opt-bug24987

--- 1.50/sql/opt_sum.cc	2007-01-30 13:06:41 -08:00
+++ 1.51/sql/opt_sum.cc	2007-01-30 13:06:41 -08:00
@@ -68,9 +68,9 @@
     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
 */
@@ -216,7 +216,7 @@
           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);
@@ -303,7 +303,7 @@
           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);

--- 1.466/sql/sql_select.cc	2007-01-30 13:06:41 -08:00
+++ 1.467/sql/sql_select.cc	2007-01-30 13:06:41 -08:00
@@ -531,22 +531,24 @@
   {
     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(tables_list, all_fields, conds)))
     {
+      if (res == HA_ERR_KEY_NOT_FOUND)
+      {
+	zero_result_cause= "No matching min/max row";
+	error=0;
+	DBUG_RETURN(0);
+      }
       if (res > 1)
       {
         thd->fatal_error();
         error= res;
 	DBUG_RETURN(1);
-      }
-      if (res < 0)
-      {
-	zero_result_cause= "No matching min/max row";
-	error=0;
-	DBUG_RETURN(0);
       }
       zero_result_cause= "Select tables optimized away";
       tables_list= 0;				// All tables resolved
Thread
bk commit into 4.1 tree (igor:1.2600) BUG#24987igor30 Jan