Skip to content

Commit e1f6c35

Browse files
Merge pull request #147 from mastak/dev-intvar-event
added intvar event
2 parents c37576b + ab78229 commit e1f6c35

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

pymysqlreplication/constants/BINLOG.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,8 @@
3636
GTID_LOG_EVENT = 0x21
3737
ANONYMOUS_GTID_LOG_EVENT = 0x22
3838
PREVIOUS_GTIDS_LOG_EVENT = 0x23
39+
40+
# INTVAR types
41+
INTVAR_INVALID_INT_EVENT = 0x00
42+
INTVAR_LAST_INSERT_ID_EVENT = 0x01
43+
INTVAR_INSERT_ID_EVENT = 0x02

pymysqlreplication/event.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,27 @@ def _dump(self):
213213
print("Dup handling flags: %d" % (self.dup_handling_flags))
214214

215215

216+
class IntvarEvent(BinLogEvent):
217+
"""
218+
219+
Attributes:
220+
type
221+
value
222+
"""
223+
def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs):
224+
super(IntvarEvent, self).__init__(from_packet, event_size, table_map,
225+
ctl_connection, **kwargs)
226+
227+
# Payload
228+
self.type = self.packet.read_uint8()
229+
self.value = self.packet.read_uint32()
230+
231+
def _dump(self):
232+
super(IntvarEvent, self)._dump()
233+
print("type: %d" % (self.type))
234+
print("Value: %d" % (self.value))
235+
236+
216237
class NotImplementedEvent(BinLogEvent):
217238
def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs):
218239
super(NotImplementedEvent, self).__init__(

pymysqlreplication/packet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class BinLogPacketWrapper(object):
3131
constants.ROTATE_EVENT: event.RotateEvent,
3232
constants.FORMAT_DESCRIPTION_EVENT: event.FormatDescriptionEvent,
3333
constants.XID_EVENT: event.XidEvent,
34-
constants.INTVAR_EVENT: event.NotImplementedEvent,
34+
constants.INTVAR_EVENT: event.IntvarEvent,
3535
constants.GTID_LOG_EVENT: event.GtidEvent,
3636
constants.STOP_EVENT: event.StopEvent,
3737
constants.BEGIN_LOAD_QUERY_EVENT: event.BeginLoadQueryEvent,

0 commit comments

Comments
 (0)