Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

refactoring before next release #405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 4, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix protocol out of sync when error happens while load local infile.
  • Loading branch information
methane committed Jan 3, 2016
commit 0eba140466f9ad58dcb996094d1bbe2f518d3244
8 changes: 6 additions & 2 deletions 8 pymysql/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,11 @@ def _read_ok_packet(self, first_packet):
def _read_load_local_packet(self, first_packet):
load_packet = LoadLocalPacketWrapper(first_packet)
sender = LoadLocalFile(load_packet.filename, self.connection)
sender.send_data()
try:
sender.send_data()
except:
self.connection._read_packet() # skip ok packet
raise

ok_packet = self.connection._read_packet()
if not ok_packet.is_ok_packet(): # pragma: no cover - upstream induced protocol error
Expand Down Expand Up @@ -1448,7 +1452,7 @@ def send_data(self):

try:
with open(self.filename, 'rb') as open_file:
chunk_size = self.connection.max_allowed_packet
chunk_size = conn.max_allowed_packet
packet = b""

while True:
Expand Down
1 change: 1 addition & 0 deletions 1 pymysql/tests/test_load_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def test_load_warnings(self):
self.assertTrue("Incorrect integer value" in str(w[-1].message))
finally:
c.execute("DROP TABLE test_load_local")
c.close()


if __name__ == "__main__":
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.