File tree 3 files changed +59
-3
lines changed
3 files changed +59
-3
lines changed Original file line number Diff line number Diff line change @@ -1075,3 +1075,18 @@ SELECT f1();
1075
1075
f1()
1076
1076
abc
1077
1077
DROP FUNCTION f1;
1078
+ DROP PROCEDURE IF EXISTS p1;
1079
+ CREATE PROCEDURE p1()
1080
+ BEGIN
1081
+ DECLARE v_char VARCHAR(255);
1082
+ DECLARE v_text TEXT DEFAULT '';
1083
+ SET v_char = 'abc';
1084
+ SET v_text = v_char;
1085
+ SET v_char = 'def';
1086
+ SET v_text = concat(v_text, '|', v_char);
1087
+ SELECT v_text;
1088
+ END|
1089
+ CALL p1();
1090
+ v_text
1091
+ abc|def
1092
+ DROP PROCEDURE p1;
Original file line number Diff line number Diff line change @@ -1271,3 +1271,39 @@ SELECT f1();
1271
1271
#
1272
1272
1273
1273
DROP FUNCTION f1;
1274
+
1275
+
1276
+ #
1277
+ # Bug#17226: Variable set in cursor on first iteration is assigned
1278
+ # second iterations value
1279
+ #
1280
+ # The problem was in incorrect handling of local variables of type
1281
+ # TEXT (BLOB).
1282
+ #
1283
+ --disable_warnings
1284
+ DROP PROCEDURE IF EXISTS p1;
1285
+ --enable_warnings
1286
+
1287
+ delimiter |;
1288
+ CREATE PROCEDURE p1()
1289
+ BEGIN
1290
+ DECLARE v_char VARCHAR(255);
1291
+ DECLARE v_text TEXT DEFAULT '';
1292
+
1293
+ SET v_char = 'abc';
1294
+
1295
+ SET v_text = v_char;
1296
+
1297
+ SET v_char = 'def';
1298
+
1299
+ SET v_text = concat(v_text, '|', v_char);
1300
+
1301
+ SELECT v_text;
1302
+ END|
1303
+ delimiter ;|
1304
+
1305
+ CALL p1();
1306
+
1307
+ DROP PROCEDURE p1;
1308
+
1309
+ # End of 5.0 tests.
Original file line number Diff line number Diff line change @@ -675,9 +675,14 @@ void field_conv(Field *to,Field *from)
675
675
{ // Be sure the value is stored
676
676
Field_blob *blob=(Field_blob*) to;
677
677
from->val_str (&blob->value );
678
- if (!blob->value .is_alloced () &&
679
- from->real_type () != MYSQL_TYPE_STRING &&
680
- from->real_type () != MYSQL_TYPE_VARCHAR)
678
+ /*
679
+ Copy value if copy_blobs is set, or source is not a string and
680
+ we have a pointer to its internal string conversion buffer.
681
+ */
682
+ if (to->table ->copy_blobs ||
683
+ (!blob->value .is_alloced () &&
684
+ from->real_type () != MYSQL_TYPE_STRING &&
685
+ from->real_type () != MYSQL_TYPE_VARCHAR))
681
686
blob->value .copy ();
682
687
blob->store (blob->value .ptr (),blob->value .length (),from->charset ());
683
688
return ;
You can’t perform that action at this time.
0 commit comments