summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorramil/ram@mysql.com/myoffice.izhnet.ru <>2006-09-21 16:05:01 +0500
committerramil/ram@mysql.com/myoffice.izhnet.ru <>2006-09-21 16:05:01 +0500
commitd3f503a0bd4160dc62998777c6d9013cad5e7efe (patch)
tree0125c7578e91dec912ae16b32e016c20f4897b07 /sql/item_strfunc.cc
parent43194fad431d953a15072657c7a26eb06bdefa8a (diff)
downloadmariadb-git-d3f503a0bd4160dc62998777c6d9013cad5e7efe.tar.gz
Fix for bug #20204: "order by" changes the results returned
Item_substr's results are improperly stored in a temporary table due to wrongly calculated max_length value for multi-byte charsets if two arguments specified.
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 1ef11945bd5..98888226e58 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1109,12 +1109,13 @@ void Item_func_substr::fix_length_and_dec()
}
if (arg_count == 3 && args[2]->const_item())
{
- int32 length= (int32) args[2]->val_int() * collation.collation->mbmaxlen;
+ int32 length= (int32) args[2]->val_int();
if (length <= 0)
max_length=0; /* purecov: inspected */
else
set_if_smaller(max_length,(uint) length);
}
+ max_length*= collation.collation->mbmaxlen;
}