summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorGuilhem Bichot <guilhem@mysql.com>2009-02-12 15:08:56 +0100
committerGuilhem Bichot <guilhem@mysql.com>2009-02-12 15:08:56 +0100
commit704b4845aa9ce51a6c5a9f5f42265e376db0dfb3 (patch)
tree73476f970c229f75846855edeeddfbc6fd87ed4b /sql/item_strfunc.cc
parent2637dda66845868fe996e60e54996acf03f6c537 (diff)
parenta5e5b0180a6b86cce258eef232ef59d6e7c40bb0 (diff)
downloadmariadb-git-704b4845aa9ce51a6c5a9f5f42265e376db0dfb3.tar.gz
merge of 5.1-main into 5.1-maria. Myisam->Maria change propagation will follow.
There were so many changes into mtr (this is the new mtr coming) that I rather copied mtr from 6.0-main here (at least this one knows how to run Maria tests). I also fixed suite/maria tests to be accepted by the new mtr. mysys/thr_mutex.c: adding DBUG_PRINT here, so that we can locate where the warning is issued.
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index bbcf76658bd..669d160d322 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1782,6 +1782,12 @@ Item *Item_func_sysconst::safe_charset_converter(CHARSET_INFO *tocs)
Item_string *conv;
uint conv_errors;
String tmp, cstr, *ostr= val_str(&tmp);
+ if (null_value)
+ {
+ Item *null_item= new Item_null((char *) fully_qualified_func_name());
+ null_item->collation.set (tocs);
+ return null_item;
+ }
cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(), tocs, &conv_errors);
if (conv_errors ||
!(conv= new Item_static_string_func(fully_qualified_func_name(),
@@ -2033,10 +2039,11 @@ Item_func_format::Item_func_format(Item *org, Item *dec)
void Item_func_format::fix_length_and_dec()
{
- 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;
+ collation.set(default_charset());
+ max_length= (char_length + max_sep_count + decimals) *
+ collation.collation->mbmaxlen;
}