Skip to content

Commit 9c781b5

Browse files
committed
enum catch out of index
enum when Mysql 5.7 case error enum and set BINLOG_IMAGE = MINIMAL erase print
1 parent 6a03460 commit 9c781b5

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

pymysqlreplication/row_event.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,17 +207,19 @@ def __read_values_name(
207207
elif column.type == FIELD_TYPE.YEAR:
208208
return self.packet.read_uint8() + 1900
209209
elif column.type == FIELD_TYPE.ENUM:
210-
return column.enum_values[self.packet.read_uint_by_size(column.size)]
210+
if column.enum_values:
211+
return column.enum_values[self.packet.read_uint_by_size(column.size)]
212+
self.packet.read_uint_by_size(column.size)
213+
return None
211214
elif column.type == FIELD_TYPE.SET:
212215
bit_mask = self.packet.read_uint_by_size(column.size)
213-
return (
214-
set(
216+
if column.set_values:
217+
return {
215218
val
216219
for idx, val in enumerate(column.set_values)
217-
if bit_mask & 2**idx
218-
)
219-
or None
220-
)
220+
if bit_mask & (1 << idx)
221+
} or None
222+
return None
221223
elif column.type == FIELD_TYPE.BIT:
222224
return self.__read_bit(column)
223225
elif column.type == FIELD_TYPE.GEOMETRY:

0 commit comments

Comments
 (0)