summaryrefslogtreecommitdiff
path: root/sql/log_event_client.cc
diff options
context:
space:
mode:
authorSachin Setiya <sachin.setiya@mariadb.com>2019-10-08 16:54:48 +0530
committerSachin Setiya <sachin.setiya@mariadb.com>2019-10-08 16:54:48 +0530
commitfc33c3cda51821a6a354b1b594c6d36d11369e18 (patch)
treeb875a3569f34c1d853b0f14b8b8154e24833dc87 /sql/log_event_client.cc
parenta07be05302ccc3baea83b7920e9162f3e91dfdcc (diff)
downloadmariadb-git-fc33c3cda51821a6a354b1b594c6d36d11369e18.tar.gz
MDEV-20591 Wrong Number of rows in mysqlbinlog output
calc_field_event_length should accurately calculate the size of BLOB type fields, Instead of returning just the bytes taken by length it should return length bytes + actual length.
Diffstat (limited to 'sql/log_event_client.cc')
-rw-r--r--sql/log_event_client.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/sql/log_event_client.cc b/sql/log_event_client.cc
index fef7add140c..7afce4eb891 100644
--- a/sql/log_event_client.cc
+++ b/sql/log_event_client.cc
@@ -1284,7 +1284,16 @@ static size_t calc_field_event_length(const uchar *ptr, uint type, uint meta)
case MYSQL_TYPE_SET:
return meta & 0xFF;
case MYSQL_TYPE_BLOB:
- return (meta <= 4 ? meta : 0);
+ if (meta > 4 )
+ return 0;
+ if (meta == 1)
+ return *ptr + 1;
+ if (meta == 2)
+ return uint2korr(ptr) + 2;
+ if (meta == 3)
+ return uint3korr(ptr) + 3;
+ if (meta == 4)
+ return uint4korr(ptr) + 4;
case MYSQL_TYPE_VARCHAR:
case MYSQL_TYPE_VAR_STRING:
length= meta;