summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergey Glukhov <Sergey.Glukhov@sun.com>2008-12-09 14:00:43 +0400
committerSergey Glukhov <Sergey.Glukhov@sun.com>2008-12-09 14:00:43 +0400
commit681a2d1a53999f70e5437f62d8478caade48f3b3 (patch)
treef0ac868ad3c90b6e75685755488f0ca501e874d1 /sql
parentcbb368aa889ad5243db2e3c486555570dbb8c494 (diff)
downloadmariadb-git-681a2d1a53999f70e5437f62d8478caade48f3b3.tar.gz
bug#35558 Wrong server metadata blows up the client
the problem: FORMAT func max_length value was calculated incorrectly the fix: correct calculation of max_length mysql-test/r/func_str.result: test result mysql-test/t/func_str.test: test case sql/item_strfunc.h: the problem: FORMAT func max_length value was calculated incorrectly the fix: correct calculation of max_length
Diffstat (limited to 'sql')
-rw-r--r--sql/item_strfunc.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 3648438a69b..23ac20a4017 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -516,8 +516,9 @@ public:
{
collation.set(default_charset());
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);
+ uint max_sep_count= char_length/3 + (decimals ? 1 : 0) + /*sign*/1;
+ max_length= (char_length + max_sep_count + decimals) *
+ collation.collation->mbmaxlen;
}
const char *func_name() const { return "format"; }
void print(String *);