mirror of
https://github.com/MariaDB/server.git
synced 2026-05-07 07:35:32 +02:00
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.
This commit is contained in:
parent
9bbfa9fbf1
commit
fc085d77ad
3 changed files with 59 additions and 3 deletions
|
|
@ -675,9 +675,14 @@ void field_conv(Field *to,Field *from)
|
|||
{ // Be sure the value is stored
|
||||
Field_blob *blob=(Field_blob*) to;
|
||||
from->val_str(&blob->value);
|
||||
if (!blob->value.is_alloced() &&
|
||||
from->real_type() != MYSQL_TYPE_STRING &&
|
||||
from->real_type() != MYSQL_TYPE_VARCHAR)
|
||||
/*
|
||||
Copy value if copy_blobs is set, or source is not a string and
|
||||
we have a pointer to its internal string conversion buffer.
|
||||
*/
|
||||
if (to->table->copy_blobs ||
|
||||
(!blob->value.is_alloced() &&
|
||||
from->real_type() != MYSQL_TYPE_STRING &&
|
||||
from->real_type() != MYSQL_TYPE_VARCHAR))
|
||||
blob->value.copy();
|
||||
blob->store(blob->value.ptr(),blob->value.length(),from->charset());
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue