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

Commit 73ccdcd

Browse filesBrowse files
kilroy42methane
authored andcommitted
Fix decoding tiny/medium/long blobs (PyMySQL#215)
1 parent 2996f9b commit 73ccdcd
Copy full SHA for 73ccdcd

File tree

Expand file treeCollapse file tree

2 files changed

+4
-5
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+4
-5
lines changed

‎MySQLdb/connections.py

Copy file name to clipboardExpand all lines: MySQLdb/connections.py
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,9 @@ def string_decoder(s):
238238
self.set_sql_mode(sql_mode)
239239

240240
if use_unicode:
241-
self.converter[FIELD_TYPE.STRING].append((None, string_decoder))
242-
self.converter[FIELD_TYPE.VAR_STRING].append((None, string_decoder))
243-
self.converter[FIELD_TYPE.VARCHAR].append((None, string_decoder))
244-
self.converter[FIELD_TYPE.BLOB].append((None, string_decoder))
241+
for t in (FIELD_TYPE.STRING, FIELD_TYPE.VAR_STRING, FIELD_TYPE.VARCHAR, FIELD_TYPE.TINY_BLOB,
242+
FIELD_TYPE.MEDIUM_BLOB, FIELD_TYPE.LONG_BLOB, FIELD_TYPE.BLOB):
243+
self.converter[t].append((None, string_decoder))
245244

246245
self.encoders[bytes] = string_literal
247246
self.encoders[unicode] = unicode_literal

‎tests/test_MySQLdb_capabilities.py

Copy file name to clipboardExpand all lines: tests/test_MySQLdb_capabilities.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def test_MULTIPOLYGON(self):
116116
c.execute("SELECT id, AsText(border) FROM test_MULTIPOLYGON")
117117
row = c.fetchone()
118118
self.assertEqual(row[0], 1)
119-
self.assertEqual(row[1], b'MULTIPOLYGON(((1 1,1 -1,-1 -1,-1 1,1 1)),((1 1,3 1,3 3,1 3,1 1)))')
119+
self.assertEqual(row[1], 'MULTIPOLYGON(((1 1,1 -1,-1 -1,-1 1,1 1)),((1 1,3 1,3 3,1 3,1 1)))')
120120

121121
c.execute("SELECT id, AsWKB(border) FROM test_MULTIPOLYGON")
122122
row = c.fetchone()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.