From 9c781b5cedc70ee62dd24c18573746079ec43792 Mon Sep 17 00:00:00 2001 From: sean Date: Tue, 19 Sep 2023 22:59:50 +0900 Subject: [PATCH] enum catch out of index enum when Mysql 5.7 case error enum and set BINLOG_IMAGE = MINIMAL erase print --- pymysqlreplication/row_event.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pymysqlreplication/row_event.py b/pymysqlreplication/row_event.py index 6b68ecf0..c1fcd852 100644 --- a/pymysqlreplication/row_event.py +++ b/pymysqlreplication/row_event.py @@ -207,17 +207,19 @@ def __read_values_name( elif column.type == FIELD_TYPE.YEAR: return self.packet.read_uint8() + 1900 elif column.type == FIELD_TYPE.ENUM: - return column.enum_values[self.packet.read_uint_by_size(column.size)] + if column.enum_values: + return column.enum_values[self.packet.read_uint_by_size(column.size)] + self.packet.read_uint_by_size(column.size) + return None elif column.type == FIELD_TYPE.SET: bit_mask = self.packet.read_uint_by_size(column.size) - return ( - set( + if column.set_values: + return { val for idx, val in enumerate(column.set_values) - if bit_mask & 2**idx - ) - or None - ) + if bit_mask & (1 << idx) + } or None + return None elif column.type == FIELD_TYPE.BIT: return self.__read_bit(column) elif column.type == FIELD_TYPE.GEOMETRY: