diff options
author | unknown <sanja@askmonty.org> | 2013-04-21 22:12:57 +0300 |
---|---|---|
committer | unknown <sanja@askmonty.org> | 2013-04-21 22:12:57 +0300 |
commit | 30e66dd6e75acc55ef2a64e7632e18c516725af4 (patch) | |
tree | 049f4adf9e482d8b12ffe4419d3e10dfc8faf6f3 /sql/item_strfunc.cc | |
parent | 3fccd933dd7e1555290de3f432911a05320f1153 (diff) | |
download | mariadb-git-30e66dd6e75acc55ef2a64e7632e18c516725af4.tar.gz |
decode_histogram fixed to show delta of the last value with maximum.
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r-- | sql/item_strfunc.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 5cce910758a..1ee4a4436fe 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -513,11 +513,10 @@ String *Item_func_decode_histogram::val_str(String *str) double prev= 0.0; uint i; str->length(0); - bool first= true; + char numbuf[32]; const uchar *p= (uchar*)res->c_ptr(); for (i= 0; i < res->length(); i++) { - char numbuf[32]; double val; switch (type) { @@ -535,13 +534,14 @@ String *Item_func_decode_histogram::val_str(String *str) /* show delta with previous value */ int size= my_snprintf(numbuf, sizeof(numbuf), representation_by_type[type], val - prev); - if (first) - first= false; - else - str->append(","); str->append(numbuf, size); + str->append(","); prev= val; } + /* show delta with max */ + int size= my_snprintf(numbuf, sizeof(numbuf), + representation_by_type[type], 1.0 - prev); + str->append(numbuf, size); null_value=0; return str; |