@@ -117,20 +117,18 @@ def is_ascii(data):
117
117
118
118
try :
119
119
print ("packet length:" , len (data ))
120
- print ("method call[1]:" , sys ._getframe (1 ).f_code .co_name )
121
- print ("method call[2]:" , sys ._getframe (2 ).f_code .co_name )
122
- print ("method call[3]:" , sys ._getframe (3 ).f_code .co_name )
123
- print ("method call[4]:" , sys ._getframe (4 ).f_code .co_name )
124
- print ("method call[5]:" , sys ._getframe (5 ).f_code .co_name )
125
- print ("-" * 88 )
120
+ for i in range (1 , 6 ):
121
+ f = sys ._getframe (i )
122
+ print ("call[%d]: %s (line %d)" % (i , f .f_code .co_name , f .f_lineno ))
123
+ print ("-" * 66 )
126
124
except ValueError :
127
125
pass
128
126
dump_data = [data [i :i + 16 ] for i in range_type (0 , min (len (data ), 256 ), 16 )]
129
127
for d in dump_data :
130
128
print (' ' .join (map (lambda x : "{:02X}" .format (byte2int (x )), d )) +
131
129
' ' * (16 - len (d )) + ' ' * 2 +
132
- ' ' .join (map (lambda x : "{}" .format (is_ascii (x )), d )))
133
- print ("-" * 88 )
130
+ '' .join (map (lambda x : "{}" .format (is_ascii (x )), d )))
131
+ print ("-" * 66 )
134
132
print ()
135
133
136
134
@@ -660,7 +658,7 @@ def _config(key, arg):
660
658
661
659
self .encoding = charset_by_name (self .charset ).encoding
662
660
663
- client_flag |= CLIENT .CAPABILITIES | CLIENT . MULTI_STATEMENTS
661
+ client_flag |= CLIENT .CAPABILITIES
664
662
if self .db :
665
663
client_flag |= CLIENT .CONNECT_WITH_DB
666
664
self .client_flag = client_flag
@@ -1357,12 +1355,13 @@ def _read_load_local_packet(self, first_packet):
1357
1355
self ._read_ok_packet (ok_packet )
1358
1356
1359
1357
def _check_packet_is_eof (self , packet ):
1360
- if packet .is_eof_packet ():
1361
- wp = EOFPacketWrapper (packet )
1362
- elif packet .is_ok_packet ():
1363
- wp = OKPacketWrapper (packet )
1364
- else :
1358
+ if not packet .is_eof_packet ():
1365
1359
return False
1360
+ #TODO: Support CLIENT.DEPRECATE_EOF
1361
+ # 1) Add DEPRECATE_EOF to CAPABILITIES
1362
+ # 2) Mask CAPABILITIES with server_capabilities
1363
+ # 3) if server_capabilities & CLIENT.DEPRECATE_EOF: use OKPacketWrapper instead of EOFPacketWrapper
1364
+ wp = EOFPacketWrapper (packet )
1366
1365
self .warning_count = wp .warning_count
1367
1366
self .has_next = wp .has_next
1368
1367
return True
@@ -1470,7 +1469,7 @@ def _get_descriptions(self):
1470
1469
self .converters .append ((encoding , converter ))
1471
1470
1472
1471
eof_packet = self .connection ._read_packet ()
1473
- assert eof_packet .is_eof_packet () or eof_packet . is_ok_packet , 'Protocol error, expecting EOF'
1472
+ assert eof_packet .is_eof_packet (), 'Protocol error, expecting EOF'
1474
1473
self .description = tuple (description )
1475
1474
1476
1475
0 commit comments