summaryrefslogtreecommitdiff
path: root/mysql-test/r/mysqlbinlog.result
diff options
context:
space:
mode:
authorunknown <mats@kindahl-laptop.dnsalias.net>2007-11-23 14:41:41 +0100
committerunknown <mats@kindahl-laptop.dnsalias.net>2007-11-23 14:41:41 +0100
commitdc8d5bc7ba7e73cd0f651c3fabc921fe3b00a2f8 (patch)
treeca29e03e585ac1ed963331ff9244c26289572e02 /mysql-test/r/mysqlbinlog.result
parent64f6ce046fc9e710152a12d4b6384355a107d25d (diff)
downloadmariadb-git-dc8d5bc7ba7e73cd0f651c3fabc921fe3b00a2f8.tar.gz
BUG#32580 (mysqlbinlog cannot read binlog event generated by user variable usage):
The client program 'mysqlbinlog' crashed when trying to print a User_var_log_event holding a floating-point value since the format specifier for my_b_printf() does not support floating-point format specifiers. This patch prints the floating-point number to an internal buffer, and then writes that buffer to the output instead. mysql-test/r/mysqlbinlog.result: Result file change. mysql-test/t/mysqlbinlog.test: Adding test that mysqlbinlog can write and read back User_var_log_event for real, decimal, integer, and string. These are the only types supported for user variables. sql/log_event.cc: Using my_sprintf() to print floating-point value of User_var_log_event value to a character buffer and then to the real output, since my_b_printf() does not support floating-point format. Also adding macro to give buffer size needed for printing floating-point numbers in %g format.
Diffstat (limited to 'mysql-test/r/mysqlbinlog.result')
-rw-r--r--mysql-test/r/mysqlbinlog.result25
1 files changed, 25 insertions, 0 deletions
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index 1deb9401aa1..cb3a4ff34ab 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -351,4 +351,29 @@ a b
1 root@localhost
DROP DATABASE mysqltest1;
DROP USER untrusted@localhost;
+BUG#32580: mysqlbinlog cannot read binlog event with user variables
+USE test;
+SET BINLOG_FORMAT = STATEMENT;
+FLUSH LOGS;
+CREATE TABLE t1 (a_real FLOAT, an_int INT, a_decimal DECIMAL(5,2), a_string CHAR(32));
+SET @a_real = rand(20) * 1000;
+SET @an_int = 1000;
+SET @a_decimal = CAST(rand(19) * 999 AS DECIMAL(5,2));
+SET @a_string = 'Just a test';
+INSERT INTO t1 VALUES (@a_real, @an_int, @a_decimal, @a_string);
+FLUSH LOGS;
+SELECT * FROM t1;
+a_real 158.883
+an_int 1000
+a_decimal 907.79
+a_string Just a test
+DROP TABLE t1;
+>> mysqlbinlog var/log/master-bin.000019 > var/tmp/bug32580.sql
+>> mysql test < var/tmp/bug32580.sql
+SELECT * FROM t1;
+a_real 158.883
+an_int 1000
+a_decimal 907.79
+a_string Just a test
+DROP TABLE t1;
End of 5.1 tests