Skip to content

Commit

Permalink
enum catch out of index
Browse files Browse the repository at this point in the history
enum when Mysql 5.7 case error

enum and set BINLOG_IMAGE = MINIMAL

erase print
  • Loading branch information
sean-k1 committed Sep 19, 2023
1 parent 6a03460 commit 9c781b5
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions pymysqlreplication/row_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 9c781b5

Please sign in to comment.