summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <kroki@mysql.com>2006-06-30 18:14:22 +0400
committerunknown <kroki@mysql.com>2006-06-30 18:14:22 +0400
commitfc085d77ade3e0cd77aebe1456c59b951301d722 (patch)
tree922256d4e955f855a6cc441d718ec5126b13236f /mysql-test
parent9bbfa9fbf1e614ebeb211693d8e89043b631e20f (diff)
downloadmariadb-git-fc085d77ade3e0cd77aebe1456c59b951301d722.tar.gz
Bug#17226: Variable set in cursor on first iteration is assigned
second iterations value During assignment to the BLOB variable in routine body the value wasn't copied. mysql-test/r/sp-vars.result: Add result for bug#17226. mysql-test/t/sp-vars.test: Add test case for bug#17226. sql/field_conv.cc: Honor copy_blobs flag.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/sp-vars.result15
-rw-r--r--mysql-test/t/sp-vars.test36
2 files changed, 51 insertions, 0 deletions
diff --git a/mysql-test/r/sp-vars.result b/mysql-test/r/sp-vars.result
index 6b4d7b1a6d3..83ee188bfa4 100644
--- a/mysql-test/r/sp-vars.result
+++ b/mysql-test/r/sp-vars.result
@@ -1075,3 +1075,18 @@ SELECT f1();
f1()
abc
DROP FUNCTION f1;
+DROP PROCEDURE IF EXISTS p1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE v_char VARCHAR(255);
+DECLARE v_text TEXT DEFAULT '';
+SET v_char = 'abc';
+SET v_text = v_char;
+SET v_char = 'def';
+SET v_text = concat(v_text, '|', v_char);
+SELECT v_text;
+END|
+CALL p1();
+v_text
+abc|def
+DROP PROCEDURE p1;
diff --git a/mysql-test/t/sp-vars.test b/mysql-test/t/sp-vars.test
index 81504904797..48dbd4de7aa 100644
--- a/mysql-test/t/sp-vars.test
+++ b/mysql-test/t/sp-vars.test
@@ -1271,3 +1271,39 @@ SELECT f1();
#
DROP FUNCTION f1;
+
+
+#
+# Bug#17226: Variable set in cursor on first iteration is assigned
+# second iterations value
+#
+# The problem was in incorrect handling of local variables of type
+# TEXT (BLOB).
+#
+--disable_warnings
+DROP PROCEDURE IF EXISTS p1;
+--enable_warnings
+
+delimiter |;
+CREATE PROCEDURE p1()
+BEGIN
+ DECLARE v_char VARCHAR(255);
+ DECLARE v_text TEXT DEFAULT '';
+
+ SET v_char = 'abc';
+
+ SET v_text = v_char;
+
+ SET v_char = 'def';
+
+ SET v_text = concat(v_text, '|', v_char);
+
+ SELECT v_text;
+END|
+delimiter ;|
+
+CALL p1();
+
+DROP PROCEDURE p1;
+
+# End of 5.0 tests.