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

Method init_unbuffered_query

pymysql/connections.py:1301–1324  ·  view source on GitHub ↗

:raise OperationalError: If the connection to the MySQL server is lost. :raise InternalError:

(self)

Source from the content-addressed store, hash-verified

1299 self.connection = None
1300
1301 def init_unbuffered_query(self):
1302 """
1303 :raise OperationalError: If the connection to the MySQL server is lost.
1304 :raise InternalError:
1305 """
1306 first_packet = self.connection._read_packet()
1307
1308 if first_packet.is_ok_packet():
1309 self.connection = None
1310 self._read_ok_packet(first_packet)
1311 elif first_packet.is_load_local_packet():
1312 try:
1313 self._read_load_local_packet(first_packet)
1314 finally:
1315 self.connection = None
1316 else:
1317 self.field_count = first_packet.read_length_encoded_integer()
1318 self._get_descriptions()
1319
1320 # Apparently, MySQLdb picks this number because it's the maximum
1321 # value of a 64bit unsigned integer. Since we're emulating MySQLdb,
1322 # we set it to this instead of None, which would be preferred.
1323 self.affected_rows = 18446744073709551615
1324 self.unbuffered_active = True
1325
1326 def _read_ok_packet(self, packet):
1327 ok_packet = OKPacketWrapper(packet)

Callers 1

_read_query_resultMethod · 0.95

Calls 7

_read_ok_packetMethod · 0.95
_get_descriptionsMethod · 0.95
_read_packetMethod · 0.80
is_ok_packetMethod · 0.80
is_load_local_packetMethod · 0.80

Tested by

no test coverage detected