MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:kpettersson Date:April 22 2008 9:53am
Subject:bk commit into 6.0 tree (thek:1.2621) BUG#31881
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of thek.  When thek 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, 2008-04-22 11:53:07+02:00, thek@adventure.(none) +3 -0
  Bug#31881 A statement is not aborted immediately if an error inside a stored routine
    
  Statement execution is not aborted immediately if an error happened
  inside a stored routine.
    
  By moving the error check into the field processing loop, execution will
  be interupted on the first error which occurs in the statement.

  mysql-test/r/errors.result@stripped, 2008-04-22 11:53:05+02:00, thek@adventure.(none) +32 -0
    Added test case.

  mysql-test/t/errors.test@stripped, 2008-04-22 11:53:05+02:00, thek@adventure.(none) +32 -0
    Added test case.

  sql/sql_class.cc@stripped, 2008-04-22 11:53:05+02:00, thek@adventure.(none) +2 -2
     Moved error checking into the field-send loop. This will cause execution
     to interrupt on the first error which occurs instead of continuing.

diff -Nrup a/mysql-test/r/errors.result b/mysql-test/r/errors.result
--- a/mysql-test/r/errors.result	2007-06-18 15:34:59 +02:00
+++ b/mysql-test/r/errors.result	2008-04-22 11:53:05 +02:00
@@ -55,3 +55,35 @@ Error	1054	Unknown column 'b' in 'field 
 INSERT INTO t1 SELECT b FROM t1;
 ERROR 42S22: Unknown column 'b' in 'field list'
 DROP TABLE t1;
+flush status;
+drop table if exists t1, t2;
+create table t1 (a int unique);
+create table t2 (a int);
+drop function if exists f1;
+Warnings:
+Note	1305	FUNCTION f1 does not exist
+drop function if exists f2;
+Warnings:
+Note	1305	FUNCTION f2 does not exist
+create function f1() returns int
+begin
+insert into t1 (a) values (1);
+insert into t1 (a) values (1);
+return 1;
+end|
+create function f2() returns int
+begin
+insert into t2 (a) values (1);
+return 2;
+end|
+flush status;
+select f1(), f2();
+ERROR 23000: Duplicate entry '1' for key 'a'
+show status like 'Com_insert';
+Variable_name	Value
+Com_insert	2
+select * from t1;
+a
+1
+select * from t2;
+a
diff -Nrup a/mysql-test/t/errors.test b/mysql-test/t/errors.test
--- a/mysql-test/t/errors.test	2007-06-18 15:34:59 +02:00
+++ b/mysql-test/t/errors.test	2008-04-22 11:53:05 +02:00
@@ -67,3 +67,35 @@ SHOW ERRORS;
 INSERT INTO t1 SELECT b FROM t1;
 DROP TABLE t1;
 # End of 5.0 tests
+
+flush status;
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+create table t1 (a int unique);
+create table t2 (a int);
+drop function if exists f1;
+drop function if exists f2;
+
+delimiter |;
+
+create function f1() returns int
+begin
+  insert into t1 (a) values (1);
+  insert into t1 (a) values (1);
+  return 1;
+end|
+create function f2() returns int
+begin
+  insert into t2 (a) values (1);
+  return 2;
+end|
+delimiter ;|
+
+flush status;
+--error 1062
+select f1(), f2();
+show status like 'Com_insert';
+select * from t1;
+select * from t2;
+
diff -Nrup a/sql/sql_class.cc b/sql/sql_class.cc
--- a/sql/sql_class.cc	2008-04-16 09:53:13 +02:00
+++ b/sql/sql_class.cc	2008-04-22 11:53:05 +02:00
@@ -1597,19 +1597,19 @@ bool select_send::send_data(List<Item> &
   Item *item;
   while ((item=li++))
   {
-    if (item->send(protocol, &buffer))
+    if (item->send(protocol, &buffer) || thd->is_error())
     {
       protocol->free();				// Free used buffer
       my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
       break;
     }
   }
-  thd->sent_row_count++;
   if (thd->is_error())
   {
     protocol->remove_last_row();
     DBUG_RETURN(1);
   }
+  thd->sent_row_count++;
   if (thd->vio_ok())
     DBUG_RETURN(protocol->write());
   DBUG_RETURN(0);
Thread
bk commit into 6.0 tree (thek:1.2621) BUG#31881kpettersson22 Apr