From 2f56757839ca88568d7652775dbfce6398c649e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 13 Dec 2017 11:26:24 +0200 Subject: [PATCH] Fix ENUM/SET string representation The value is now stored as a hexadecimal value instead of a decimal value. This also lifts the enum size restriction on more than 8 values (which was incorrectly documented as 255 values). --- server/modules/routing/avrorouter/avro_rbr.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/server/modules/routing/avrorouter/avro_rbr.c b/server/modules/routing/avrorouter/avro_rbr.c index a4e8f0c97..3fcf1bf8f 100644 --- a/server/modules/routing/avrorouter/avro_rbr.c +++ b/server/modules/routing/avrorouter/avro_rbr.c @@ -526,16 +526,8 @@ uint8_t* process_row_event_data(TABLE_MAP *map, TABLE_CREATE *create, avro_value { uint8_t val[metadata[metadata_offset + 1]]; uint64_t bytes = unpack_enum(ptr, &metadata[metadata_offset], val); - char strval[32]; - - /** Right now only ENUMs/SETs with less than 256 values - * are printed correctly */ - snprintf(strval, sizeof(strval), "%hhu", val[0]); - if (bytes > 1 && warn_large_enumset) - { - warn_large_enumset = true; - MXS_WARNING("ENUM/SET values larger than 255 values aren't supported."); - } + char strval[bytes * 2 + 1]; + gw_bin2hex(strval, val, bytes); avro_value_set_string(&field, strval); MXS_INFO("[%ld] ENUM: %lu bytes", i, bytes); ptr += bytes;