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

add surrogate escape for callproc and test case for that #104

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 1 commit into from
Jul 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion 2 MySQLdb/cursors.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def callproc(self, procname, args=()):
q = "SET @_%s_%d=%s" % (procname, index,
db.literal(arg))
if isinstance(q, unicode):
q = q.encode(db.unicode_literal.charset)
q = q.encode(db.unicode_literal.charset, 'surrogateescape')
self._query(q)
self.nextset()

Expand Down
5 changes: 3 additions & 2 deletions 5 tests/test_MySQLdb_capabilities.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import capabilities
from datetime import timedelta
import unittest
Expand Down Expand Up @@ -43,7 +44,7 @@ def test_stored_procedures(self):
c = self.cursor
self.create_table(('pos INT', 'tree CHAR(20)'))
c.executemany("INSERT INTO %s (pos,tree) VALUES (%%s,%%s)" % self.table,
list(enumerate('ash birch cedar larch pine'.split())))
list(enumerate('ash birch cedar Lärche pine'.split())))
db.commit()

c.execute("""
Expand All @@ -54,7 +55,7 @@ def test_stored_procedures(self):
""" % self.table)
db.commit()

c.callproc('test_sp', ('larch',))
c.callproc('test_sp', ('Lärche',))
rows = c.fetchall()
self.assertEqual(len(rows), 1)
self.assertEqual(rows[0][0], 3)
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.