diff options
author | unknown <gluh@eagle.intranet.mysql.r18.ru> | 2006-03-06 12:52:38 +0400 |
---|---|---|
committer | unknown <gluh@eagle.intranet.mysql.r18.ru> | 2006-03-06 12:52:38 +0400 |
commit | bb453729b8860fca3f3064287fecf566faa35397 (patch) | |
tree | e545f4c60e224f87066d458e1d421202f502ac32 /sql/item_strfunc.h | |
parent | 2e81899948f34d386eac8a25e71d9b575646c334 (diff) | |
download | mariadb-git-bb453729b8860fca3f3064287fecf566faa35397.tar.gz |
Fix for bug#16678 FORMAT gives wrong result if client run with default-character-set=utf8
calculate Item_func_format::max_length using charset->mbmaxlen
mysql-test/r/func_math.result:
Fix for bug#16678 FORMAT gives wrong result if client run with default-character-set=utf8
test case
mysql-test/t/func_math.test:
Fix for bug#16678 FORMAT gives wrong result if client run with default-character-set=utf8
test case
Diffstat (limited to 'sql/item_strfunc.h')
-rw-r--r-- | sql/item_strfunc.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 50ec0b36ce8..6a95a9e5d1f 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -471,7 +471,9 @@ public: void fix_length_and_dec() { collation.set(default_charset()); - max_length=args[0]->max_length+(args[0]->max_length-args[0]->decimals)/3; + uint char_length= args[0]->max_length/args[0]->collation.collation->mbmaxlen; + max_length= ((char_length + (char_length-args[0]->decimals)/3) * + collation.collation->mbmaxlen); } const char *func_name() const { return "format"; } void print(String *); |