MCPcopy Create free account
hub / github.com/PyMySQL/PyMySQL / OKPacketWrapper

Class OKPacketWrapper

pymysql/protocol.py:279–304  ·  view source on GitHub ↗

OK Packet Wrapper. It uses an existing packet object, and wraps around it, exposing useful variables while still providing access to the original packet objects variables and methods.

Source from the content-addressed store, hash-verified

277
278
279class OKPacketWrapper:
280 """
281 OK Packet Wrapper. It uses an existing packet object, and wraps
282 around it, exposing useful variables while still providing access
283 to the original packet objects variables and methods.
284 """
285
286 def __init__(self, from_packet):
287 if not from_packet.is_ok_packet():
288 raise ValueError(
289 "Cannot create "
290 + str(self.__class__.__name__)
291 + " object from invalid packet type"
292 )
293
294 self.packet = from_packet
295 self.packet.advance(1)
296
297 self.affected_rows = self.packet.read_length_encoded_integer()
298 self.insert_id = self.packet.read_length_encoded_integer()
299 self.server_status, self.warning_count = self.read_struct("<HH")
300 self.message = self.packet.read_all()
301 self.has_next = self.server_status & SERVER_STATUS.SERVER_MORE_RESULTS_EXISTS
302
303 def __getattr__(self, key):
304 return getattr(self.packet, key)
305
306
307class EOFPacketWrapper:

Callers 2

_read_ok_packetMethod · 0.85
_read_ok_packetMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected