summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2015-09-07 13:13:52 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2015-09-07 13:13:52 +0200
commit29ac245dd04c5416d57a90b0ab3c4d08cbc4d723 (patch)
tree1bb6c357ec3ef7dc861c5102ab5b2e1a23eed621 /sql
parent102a85f9f30cdf8c3baa3893c68932617240bfa6 (diff)
downloadmariadb-git-29ac245dd04c5416d57a90b0ab3c4d08cbc4d723.tar.gz
MDEV-8473: mysqlbinlog -v does not properly decode DECIMAL values in an RBR log
Backport of upstream patch. revno: 5696
Diffstat (limited to 'sql')
-rw-r--r--sql/log_event.cc13
1 files changed, 4 insertions, 9 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 2d5c3f232a4..c962f19f703 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -2012,15 +2012,10 @@ log_event_print_value(IO_CACHE *file, const uchar *ptr,
my_decimal dec;
binary2my_decimal(E_DEC_FATAL_ERROR, (uchar*) ptr, &dec,
precision, decimals);
- int i, end;
- char buff[512], *pos;
- pos= buff;
- pos+= sprintf(buff, "%s", dec.sign() ? "-" : "");
- end= ROUND_UP(dec.frac) + ROUND_UP(dec.intg)-1;
- for (i=0; i < end; i++)
- pos+= sprintf(pos, "%09d.", dec.buf[i]);
- pos+= sprintf(pos, "%09d", dec.buf[i]);
- my_b_printf(file, "%s", buff);
+ int length= DECIMAL_MAX_STR_LENGTH;
+ char buff[DECIMAL_MAX_STR_LENGTH + 1];
+ decimal2string(&dec, buff, &length, 0, 0, 0);
+ my_b_write(file, (uchar*)buff, length);
my_snprintf(typestr, typestr_length, "DECIMAL(%d,%d)",
precision, decimals);
return bin_size;