List:Commits« Previous MessageNext Message »
From:marc.alff Date:January 15 2007 4:51pm
Subject:bk commit into 5.0 tree (malff:1.2383)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of marcsql. When marcsql 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-15 08:51:41-07:00, malff@weblab.(none) +4 -0
  Merge malff@stripped:/home/bk/mysql-5.0-runtime
  into  weblab.(none):/home/marcsql/TREE/mysql-5.0-runtime
  MERGE: 1.2294.4.17

  mysql-test/r/sp.result@stripped, 2007-01-15 08:51:27-07:00, malff@weblab.(none) +0 -0
    Auto merged
    MERGE: 1.214.1.3

  mysql-test/t/sp.test@stripped, 2007-01-15 08:51:27-07:00, malff@weblab.(none) +28 -28
    Auto merged
    MERGE: 1.205.1.2

  mysql-test/t/trigger.test@stripped, 2007-01-15 08:51:27-07:00, malff@weblab.(none) +0 -0
    Auto merged
    MERGE: 1.53.1.4

  sql/sp_head.cc@stripped, 2007-01-15 08:51:27-07:00, malff@weblab.(none) +0 -0
    Auto merged
    MERGE: 1.224.1.4

# 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:	malff
# Host:	weblab.(none)
# Root:	/home/marcsql/TREE/mysql-5.0-runtime/RESYNC

--- 1.57/mysql-test/t/trigger.test	2007-01-15 08:51:48 -07:00
+++ 1.58/mysql-test/t/trigger.test	2007-01-15 08:51:48 -07:00
@@ -1140,6 +1140,7 @@ select trigger_schema, trigger_name, eve
 # Trick which makes update of second .TRN file impossible
 system echo dummy >$MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~;
 system chmod 000 $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~;
+--replace_result $MYSQLTEST_VARDIR . master-data/ ''
 --error 1
 rename table t1 to t2;
 # 't1' should be still there and triggers should work correctly

--- 1.217/mysql-test/r/sp.result	2007-01-15 08:51:48 -07:00
+++ 1.218/mysql-test/r/sp.result	2007-01-15 08:51:48 -07:00
@@ -2705,11 +2705,11 @@ row_count()
 call bug4905()|
 select row_count()|
 row_count()
-0
+-1
 call bug4905()|
 select row_count()|
 row_count()
-0
+-1
 select * from t3|
 s1
 1
@@ -5626,5 +5626,103 @@ Called B
 Called B
 drop procedure proc_21462_a|
 drop procedure proc_21462_b|
+drop table if exists t3|
+drop procedure if exists proc_bug19733|
+create table t3 (s1 int)|
+create procedure proc_bug19733()
+begin
+declare v int default 0;
+while v < 100 do
+create index i on t3 (s1);
+drop index i on t3;
+set v = v + 1;
+end while;
+end|
+call proc_bug19733()|
+call proc_bug19733()|
+call proc_bug19733()|
+drop procedure proc_bug19733|
+drop table t3|
 End of 5.0 tests
+DROP TABLE IF EXISTS bug23760|
+DROP TABLE IF EXISTS bug23760_log|
+DROP PROCEDURE IF EXISTS bug23760_update_log|
+DROP PROCEDURE IF EXISTS bug23760_test_row_count|
+DROP FUNCTION IF EXISTS bug23760_rc_test|
+CREATE TABLE bug23760 (
+id INT NOT NULL AUTO_INCREMENT ,
+num INT NOT NULL ,
+PRIMARY KEY ( id ) 
+)|
+CREATE TABLE bug23760_log (
+id INT NOT NULL AUTO_INCREMENT ,
+reason VARCHAR(50)NULL ,
+ammount INT NOT NULL ,
+PRIMARY KEY ( id ) 
+)|
+CREATE PROCEDURE bug23760_update_log(r Varchar(50), a INT)
+BEGIN
+INSERT INTO bug23760_log (reason, ammount) VALUES(r, a);
+END|
+CREATE PROCEDURE bug23760_test_row_count()
+BEGIN
+UPDATE bug23760 SET num = num + 1;
+CALL bug23760_update_log('Test is working', ROW_COUNT());
+UPDATE bug23760 SET num = num - 1;
+END|
+CREATE PROCEDURE bug23760_test_row_count2(level INT)
+BEGIN
+IF level THEN
+UPDATE bug23760 SET num = num + 1;
+CALL bug23760_update_log('Test2 is working', ROW_COUNT());
+CALL bug23760_test_row_count2(level - 1);
+END IF;
+END|
+CREATE FUNCTION bug23760_rc_test(in_var INT) RETURNS INT RETURN in_var|
+INSERT INTO bug23760 (num) VALUES (0), (1), (1), (2), (3), (5), (8)|
+SELECT ROW_COUNT()|
+ROW_COUNT()
+7
+CALL bug23760_test_row_count()|
+SELECT * FROM bug23760_log ORDER BY id|
+id	reason	ammount
+1	Test is working	7
+SET @save_max_sp_recursion= @@max_sp_recursion_depth|
+SELECT @save_max_sp_recursion|
+@save_max_sp_recursion
+0
+SET max_sp_recursion_depth= 5|
+SELECT @@max_sp_recursion_depth|
+@@max_sp_recursion_depth
+5
+CALL bug23760_test_row_count2(2)|
+SELECT ROW_COUNT()|
+ROW_COUNT()
+1
+SELECT * FROM bug23760_log ORDER BY id|
+id	reason	ammount
+1	Test is working	7
+2	Test2 is working	7
+3	Test2 is working	7
+SELECT * FROM bug23760 ORDER by ID|
+id	num
+1	2
+2	3
+3	3
+4	4
+5	5
+6	7
+7	10
+SET max_sp_recursion_depth= @save_max_sp_recursion|
+SELECT bug23760_rc_test(123)|
+bug23760_rc_test(123)
+123
+INSERT INTO bug23760 (num) VALUES (13), (21), (34), (55)|
+SELECT bug23760_rc_test(ROW_COUNT())|
+bug23760_rc_test(ROW_COUNT())
+4
+DROP TABLE bug23760, bug23760_log|
+DROP PROCEDURE bug23760_update_log|
+DROP PROCEDURE bug23760_test_row_count|
+DROP FUNCTION bug23760_rc_test|
 drop table t1,t2;

--- 1.206/mysql-test/t/sp.test	2007-01-15 08:51:48 -07:00
+++ 1.207/mysql-test/t/sp.test	2007-01-15 08:51:48 -07:00
@@ -6587,8 +6587,113 @@ call proc_21462_b(1)|
 drop procedure proc_21462_a|
 drop procedure proc_21462_b|
 
+
+#
+# Bug#19733 "Repeated alter, or repeated create/drop, fails"
+# Check that CREATE/DROP INDEX is re-execution friendly.
+# 
+--disable_warnings
+drop table if exists t3|
+drop procedure if exists proc_bug19733|
+--enable_warnings
+create table t3 (s1 int)|
+
+create procedure proc_bug19733()
+begin
+  declare v int default 0;
+  while v < 100 do
+    create index i on t3 (s1);
+    drop index i on t3;
+    set v = v + 1;
+  end while;
+end|
+
+call proc_bug19733()|
+call proc_bug19733()|
+call proc_bug19733()|
+
+drop procedure proc_bug19733|
+drop table t3|
+
 --echo End of 5.0 tests
 
+
+#
+# BUG#23760: ROW_COUNT() and store procedure not owrking together
+#
+--disable_warnings
+DROP TABLE IF EXISTS bug23760|
+DROP TABLE IF EXISTS bug23760_log|
+DROP PROCEDURE IF EXISTS bug23760_update_log|
+DROP PROCEDURE IF EXISTS bug23760_test_row_count|
+DROP FUNCTION IF EXISTS bug23760_rc_test|
+--enable_warnings
+CREATE TABLE bug23760 (
+  id INT NOT NULL AUTO_INCREMENT ,
+  num INT NOT NULL ,
+  PRIMARY KEY ( id ) 
+)|
+
+CREATE TABLE bug23760_log (
+ id INT NOT NULL AUTO_INCREMENT ,
+ reason VARCHAR(50)NULL ,
+ ammount INT NOT NULL ,
+  PRIMARY KEY ( id ) 
+)|
+
+CREATE PROCEDURE bug23760_update_log(r Varchar(50), a INT)
+BEGIN
+  INSERT INTO bug23760_log (reason, ammount) VALUES(r, a);
+END|
+
+CREATE PROCEDURE bug23760_test_row_count()
+BEGIN
+  UPDATE bug23760 SET num = num + 1;
+  CALL bug23760_update_log('Test is working', ROW_COUNT());
+  UPDATE bug23760 SET num = num - 1;
+END|
+
+
+CREATE PROCEDURE bug23760_test_row_count2(level INT)
+BEGIN
+  IF level THEN
+    UPDATE bug23760 SET num = num + 1;
+    CALL bug23760_update_log('Test2 is working', ROW_COUNT());
+    CALL bug23760_test_row_count2(level - 1);
+  END IF;
+END|
+
+CREATE FUNCTION bug23760_rc_test(in_var INT) RETURNS INT RETURN in_var|
+
+INSERT INTO bug23760 (num) VALUES (0), (1), (1), (2), (3), (5), (8)|
+SELECT ROW_COUNT()|
+
+CALL bug23760_test_row_count()|
+SELECT * FROM bug23760_log ORDER BY id|
+
+SET @save_max_sp_recursion= @@max_sp_recursion_depth|
+SELECT @save_max_sp_recursion|
+SET max_sp_recursion_depth= 5|
+SELECT @@max_sp_recursion_depth|
+CALL bug23760_test_row_count2(2)|
+SELECT ROW_COUNT()|
+SELECT * FROM bug23760_log ORDER BY id|
+SELECT * FROM bug23760 ORDER by ID|
+SET max_sp_recursion_depth= @save_max_sp_recursion|
+
+SELECT bug23760_rc_test(123)|
+INSERT INTO bug23760 (num) VALUES (13), (21), (34), (55)|
+SELECT bug23760_rc_test(ROW_COUNT())|
+
+DROP TABLE bug23760, bug23760_log|
+DROP PROCEDURE bug23760_update_log|
+DROP PROCEDURE bug23760_test_row_count|
+DROP FUNCTION bug23760_rc_test|
+
+#
+# NOTE: The delimiter is `|`, and not `;`. It is changed to `;`
+#       at the end of the file!
+#
 
 #
 # BUG#NNNN: New bug synopsis

--- 1.227/sql/sp_head.cc	2007-01-15 08:51:48 -07:00
+++ 1.228/sql/sp_head.cc	2007-01-15 08:51:48 -07:00
@@ -2,8 +2,7 @@
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
+   the Free Software Foundation; version 2 of the License.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -444,9 +443,12 @@ sp_head::operator delete(void *ptr, size
 sp_head::sp_head()
   :Query_arena(&main_mem_root, INITIALIZED_FOR_SP),
    m_flags(0), m_recursion_level(0), m_next_cached_sp(0),
-   m_first_instance(this), m_first_free_instance(this), m_last_cached_sp(this),
    m_cont_level(0)
 {
+  m_first_instance= this;
+  m_first_free_instance= this;
+  m_last_cached_sp= this;
+
   m_return_field_def.charset = NULL;
 
   extern byte *
@@ -1627,7 +1629,7 @@ sp_head::execute_procedure(THD *thd, Lis
         Item_null *null_item= new Item_null();
 
         if (!null_item ||
-            nctx->set_variable(thd, i, (struct Item **)&null_item))
+            nctx->set_variable(thd, i, (Item **)&null_item))
         {
           err_status= TRUE;
           break;
@@ -2805,7 +2807,7 @@ void
 sp_instr_freturn::print(String *str)
 {
   /* freturn type expr... */
-  if (str->reserve(UINT_MAX+8+32)) // Add some for the expr. too
+  if (str->reserve(1024+8+32)) // Add some for the expr. too
     return;
   str->qs_append(STRING_WITH_LEN("freturn "));
   str->qs_append((uint)m_type);
Thread
bk commit into 5.0 tree (malff:1.2383)marc.alff17 Jan