Skip to content

Commit

Permalink
Revert DEPRECATE_EOF support
Browse files Browse the repository at this point in the history
  • Loading branch information
methane committed Sep 3, 2016
1 parent c09ba86 commit ced55c4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
15 changes: 8 additions & 7 deletions pymysql/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ def _config(key, arg):

self.encoding = charset_by_name(self.charset).encoding

client_flag |= CLIENT.CAPABILITIES | CLIENT.MULTI_STATEMENTS
client_flag |= CLIENT.CAPABILITIES
if self.db:
client_flag |= CLIENT.CONNECT_WITH_DB
self.client_flag = client_flag
Expand Down Expand Up @@ -1355,12 +1355,13 @@ def _read_load_local_packet(self, first_packet):
self._read_ok_packet(ok_packet)

def _check_packet_is_eof(self, packet):
if packet.is_eof_packet():
wp = EOFPacketWrapper(packet)
elif packet.is_ok_packet():
wp = OKPacketWrapper(packet)
else:
if not packet.is_eof_packet():
return False
#TODO: Support CLIENT.DEPRECATE_EOF
# 1) Add DEPRECATE_EOF to CAPABILITIES
# 2) Mask CAPABILITIES with server_capabilities
# 3) if server_capabilities & CLIENT.DEPRECATE_EOF: use OKPacketWrapper instead of EOFPacketWrapper
wp = EOFPacketWrapper(packet)
self.warning_count = wp.warning_count
self.has_next = wp.has_next
return True
Expand Down Expand Up @@ -1468,7 +1469,7 @@ def _get_descriptions(self):
self.converters.append((encoding, converter))

eof_packet = self.connection._read_packet()
assert eof_packet.is_eof_packet() or eof_packet.is_ok_packet, 'Protocol error, expecting EOF'
assert eof_packet.is_eof_packet(), 'Protocol error, expecting EOF'
self.description = tuple(description)


Expand Down
8 changes: 5 additions & 3 deletions pymysql/constants/CLIENT.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
PS_MULTI_RESULTS = 1 << 18
PLUGIN_AUTH = 1 << 19
PLUGIN_AUTH_LENENC_CLIENT_DATA = 1 << 21
CAPABILITIES = (LONG_PASSWORD | LONG_FLAG | TRANSACTIONS |
PROTOCOL_41 | SECURE_CONNECTION | PLUGIN_AUTH |
PLUGIN_AUTH_LENENC_CLIENT_DATA)
CAPABILITIES = (
LONG_PASSWORD | LONG_FLAG | PROTOCOL_41 | TRANSACTIONS
| SECURE_CONNECTION | MULTI_STATEMENTS | MULTI_RESULTS
| PLUGIN_AUTH | PLUGIN_AUTH_LENENC_CLIENT_DATA)

# Not done yet
CONNECT_ATTRS = 1 << 20
HANDLE_EXPIRED_PASSWORDS = 1 << 22
Expand Down

0 comments on commit ced55c4

Please sign in to comment.