summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorunknown <bar@bar.mysql.r18.ru>2003-05-23 11:32:35 +0500
committerunknown <bar@bar.mysql.r18.ru>2003-05-23 11:32:35 +0500
commit0ce726d5eeb78d9e44951542d9190fe003375b16 (patch)
treee6c1f494c1ac6b5d055d2b2aadf9285729a5e36e /sql/item_strfunc.cc
parent79decad27a7c8e8dd63ab90fe9a52ee9adc2ec9e (diff)
downloadmariadb-git-0ce726d5eeb78d9e44951542d9190fe003375b16.tar.gz
CREATE TABLE t1 SELECT left(_latin2'a',1) didn't work, the charset got lost
Collation and coercibility tests for string functions mysql-test/r/func_str.result: Collation and coercibility tests for string functions mysql-test/t/func_str.test: Collation and coercibility tests for string functions sql/item_strfunc.cc: Collation and coercibility tests for string functions
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 078e3f213a0..eb34c8691a3 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -928,7 +928,7 @@ void Item_str_func::left_right_max_length()
max_length=args[0]->max_length;
if (args[1]->const_item())
{
- int length=(int) args[1]->val_int()*default_charset_info->mbmaxlen;
+ int length=(int) args[1]->val_int()*charset()->mbmaxlen;
if (length <= 0)
max_length=0;
else
@@ -939,6 +939,7 @@ void Item_str_func::left_right_max_length()
void Item_func_left::fix_length_and_dec()
{
+ set_charset(args[0]->charset(), args[0]->coercibility);
left_right_max_length();
}
@@ -965,6 +966,7 @@ String *Item_func_right::val_str(String *str)
void Item_func_right::fix_length_and_dec()
{
+ set_charset(args[0]->charset(), args[0]->coercibility);
left_right_max_length();
}