def loadFromPacket(packet): obj = EOF() proto = Proto(packet, 3) obj.sequenceId = proto.get_fixed_int(1) proto.get_filler(1) obj.statusFlags = proto.get_fixed_int(2) obj.warnings = proto.get_fixed_int(2) return obj
def loadFromPacket(packet): obj = OK() proto = Proto(packet, 3) obj.sequenceId = proto.get_fixed_int(1) proto.get_filler(1) obj.affectedRows = proto.get_lenenc_int() obj.lastInsertId = proto.get_lenenc_int() obj.statusFlags = proto.get_fixed_int(2) obj.warnings = proto.get_fixed_int(2) return obj
def loadFromPacket(packet): obj = ERR() proto = Proto(packet, 3) obj.sequenceId = proto.get_fixed_int(1) proto.get_filler(1) obj.errorCode = proto.get_fixed_int(2) proto.get_filler(1) obj.sqlState = proto.get_fixed_str(5) obj.errorMessage = proto.get_eop_str() return obj
def loadFromPacket(packet): obj = Request() proto = Proto(packet, 3) obj.sequenceId = proto.get_fixed_int(1) obj.filename = proto.get_eop_str() return obj
def loadFromPacket(packet): obj = Response() proto = Proto(packet, 3) obj.sequenceId = proto.get_fixed_int(1) obj.data = proto.packet[proto.offset:] return obj
def loadFromPacket(packet): obj = Row() proto = Proto(packet, 3) obj.sequenceId = proto.get_fixed_int(1) # TODO: Extract row data here return obj
def loadFromPacket(packet): obj = Column() proto = Proto(packet, 3) obj.sequenceId = proto.get_fixed_int(1) obj.catalog = proto.get_lenenc_str() obj.schema = proto.get_lenenc_str() obj.table = proto.get_lenenc_str() obj.org_table = proto.get_lenenc_str() obj.name = proto.get_lenenc_str() obj.org_name = proto.get_lenenc_str() proto.get_filler(1) obj.characterSet = proto.get_fixed_int(2) obj.columnLength = proto.get_fixed_int(4) obj.type = proto.get_fixed_int(1) obj.flags = proto.get_fixed_int(2) obj.decimals = proto.get_fixed_int(1) proto.get_filler(2) return obj
def loadFromPacket(packet): """ >>> colcount = ColCount() >>> colcount.sequenceId = 1 >>> colcount.colCount = 5 >>> colcount.colCount 5 >>> pkt = colcount.toPacket() >>> pkt bytearray(b'\\x01\\x00\\x00\\x01\\x05') >>> colcount2 = ColCount.loadFromPacket(pkt) >>> colcount2.colCount 5 >>> colcount2.sequenceId 1 """ obj = ColCount() proto = Proto(packet, 3) obj.sequenceId = proto.get_fixed_int(1) obj.colCount = proto.get_lenenc_int() return obj