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 c7d2168

Browse filesBrowse files
woojingmethane
authored andcommitted
add surrogate escape for callproc and test case for that (PyMySQL#104)
1 parent fb842fb commit c7d2168
Copy full SHA for c7d2168

File tree

Expand file treeCollapse file tree

2 files changed

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

2 files changed

+4
-3
lines changed

‎MySQLdb/cursors.py

Copy file name to clipboardExpand all lines: MySQLdb/cursors.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ def callproc(self, procname, args=()):
347347
q = "SET @_%s_%d=%s" % (procname, index,
348348
db.literal(arg))
349349
if isinstance(q, unicode):
350-
q = q.encode(db.unicode_literal.charset)
350+
q = q.encode(db.unicode_literal.charset, 'surrogateescape')
351351
self._query(q)
352352
self.nextset()
353353

‎tests/test_MySQLdb_capabilities.py

Copy file name to clipboardExpand all lines: tests/test_MySQLdb_capabilities.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
23
import capabilities
34
from datetime import timedelta
45
import unittest
@@ -43,7 +44,7 @@ def test_stored_procedures(self):
4344
c = self.cursor
4445
self.create_table(('pos INT', 'tree CHAR(20)'))
4546
c.executemany("INSERT INTO %s (pos,tree) VALUES (%%s,%%s)" % self.table,
46-
list(enumerate('ash birch cedar larch pine'.split())))
47+
list(enumerate('ash birch cedar Lärche pine'.split())))
4748
db.commit()
4849

4950
c.execute("""
@@ -54,7 +55,7 @@ def test_stored_procedures(self):
5455
""" % self.table)
5556
db.commit()
5657

57-
c.callproc('test_sp', ('larch',))
58+
c.callproc('test_sp', ('Lärche',))
5859
rows = c.fetchall()
5960
self.assertEqual(len(rows), 1)
6061
self.assertEqual(rows[0][0], 3)

0 commit comments

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