MCPcopy
hub / github.com/PyMySQL/PyMySQL / OKPacketWrapper

Class OKPacketWrapper

pymysql/protocol.py:286–311  ·  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

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

Callers 2

_read_ok_packetMethod · 0.85
_read_ok_packetMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…