MCPcopy
hub / github.com/PyMySQL/PyMySQL / write_packet

Method write_packet

pymysql/connections.py:751–761  ·  view source on GitHub ↗

Writes an entire "mysql packet" in its entirety to the network adding its length and sequence number.

(self, payload)

Source from the content-addressed store, hash-verified

749 raise
750
751 def write_packet(self, payload):
752 """Writes an entire "mysql packet" in its entirety to the network
753 adding its length and sequence number.
754 """
755 # Internal note: when you build packet manually and calls _write_bytes()
756 # directly, you should set self._next_seq_id properly.
757 data = _pack_int24(len(payload)) + bytes([self._next_seq_id]) + payload
758 if DEBUG:
759 dump_packet(data)
760 self._write_bytes(data)
761 self._next_seq_id = (self._next_seq_id + 1) % 256
762
763 def _read_packet(self, packet_type=MysqlPacket):
764 """Read an entire "mysql packet" in its entirety from the network

Callers 6

_execute_commandMethod · 0.95
_process_authMethod · 0.95
_roundtripFunction · 0.80
send_dataMethod · 0.80
authenticateMethod · 0.80

Calls 3

_write_bytesMethod · 0.95
_pack_int24Function · 0.85
dump_packetFunction · 0.85

Tested by 1

authenticateMethod · 0.64