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-14 16:43:30+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-14 16:43:28+02:00, thek@adventure.(none) +35 -0
Added test case
mysql-test/t/errors.test@stripped, 2008-04-14 16:43:28+02:00, thek@adventure.(none) +30 -0
Added test case
sql/sql_class.cc@stripped, 2008-04-14 16:43:28+02:00, thek@adventure.(none) +5 -5
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-14 16:43:28 +02:00
@@ -55,3 +55,38 @@ 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;
+Warnings:
+Note 1051 Unknown table 't1'
+Note 1051 Unknown table '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-14 16:43:28 +02:00
@@ -67,3 +67,33 @@ SHOW ERRORS;
INSERT INTO t1 SELECT b FROM t1;
DROP TABLE t1;
# End of 5.0 tests
+
+flush status;
+drop table if exists t1, t2;
+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-03-28 15:00:34 +01:00
+++ b/sql/sql_class.cc 2008-04-14 16:43:28 +02:00
@@ -1601,13 +1601,13 @@ bool select_send::send_data(List<Item> &
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
break;
}
+ if (thd->is_error())
+ {
+ protocol->remove_last_row();
+ DBUG_RETURN(1);
+ }
}
thd->sent_row_count++;
- if (thd->is_error())
- {
- protocol->remove_last_row();
- DBUG_RETURN(1);
- }
if (thd->vio_ok())
DBUG_RETURN(protocol->write());
DBUG_RETURN(0);
| Thread |
|---|
| • bk commit into 6.0 tree (thek:1.2634) BUG#31881 | kpettersson | 14 Apr |