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

Method _read_bytes

pymysql/connections.py:823–847  ·  view source on GitHub ↗
(self, num_bytes)

Source from the content-addressed store, hash-verified

821 return packet
822
823 def _read_bytes(self, num_bytes):
824 # NOTE: caller should call self._sock.settimeout(self._read_timeout)
825 # before first read.
826 while True:
827 try:
828 data = self._rfile.read(num_bytes)
829 break
830 except OSError as e:
831 if e.errno == errno.EINTR:
832 continue
833 self._force_close()
834 raise err.OperationalError(
835 CR.CR_SERVER_LOST,
836 f"Lost connection to MySQL server during query ({e})",
837 )
838 except BaseException:
839 # Don't convert unknown exception to MySQLError.
840 self._force_close()
841 raise
842 if len(data) < num_bytes:
843 self._force_close()
844 raise err.OperationalError(
845 CR.CR_SERVER_LOST, "Lost connection to MySQL server during query"
846 )
847 return data
848
849 def _write_bytes(self, data):
850 if self._current_timeout != self._write_timeout:

Callers 1

_read_packetMethod · 0.95

Calls 2

_force_closeMethod · 0.95
readMethod · 0.45

Tested by

no test coverage detected