diff options
author | monty@mashka.mysql.fi <> | 2003-05-13 10:54:07 +0300 |
---|---|---|
committer | monty@mashka.mysql.fi <> | 2003-05-13 10:54:07 +0300 |
commit | 4bde719df7b67e8c42c16724af0e3eacb64c3757 (patch) | |
tree | 911f869319dc53526bc2bb909aa87944db9d2696 /sql/item_strfunc.cc | |
parent | 5b7a86faec185e5d787586a35ee6866e12997836 (diff) | |
download | mariadb-git-4bde719df7b67e8c42c16724af0e3eacb64c3757.tar.gz |
Safety fix to enable RAID in max binaries
Better fix for format('nan')
Fix for HAVING COUNT(DISTINCT...)
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r-- | sql/item_strfunc.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 9876b77e8cb..ae8bf1dfecb 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1473,15 +1473,17 @@ String *Item_func_format::val_str(String *str) str_length=str->length(); if (nr < 0) str_length--; // Don't count sign - length=str->length()+(diff=(str_length- dec-1)/3); - if (diff && diff < 330) // size of buff ... + + /* We need this test to handle 'nan' values */ + if (str_length >= dec+4) { char *tmp,*pos; - str=copy_if_not_alloced(&tmp_str,str,length); + length= str->length()+(diff=(str_length- dec-1)/3); + str= copy_if_not_alloced(&tmp_str,str,length); str->length(length); - tmp=(char*) str->ptr()+length - dec-1; - for (pos=(char*) str->ptr()+length ; pos != tmp; pos--) - pos[0]=pos[- (int) diff]; + tmp= (char*) str->ptr()+length - dec-1; + for (pos= (char*) str->ptr()+length ; pos != tmp; pos--) + pos[0]= pos[-(int) diff]; while (diff) { pos[0]=pos[-(int) diff]; pos--; |