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 9178048

Browse filesBrowse files
authored
Reduce callproc roundtrip time (PyMySQL#223)
Make only one single call to SET variables used as procedure parameters
2 parents a2ebbd2 + f2f94dc commit 9178048
Copy full SHA for 9178048

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+4
-3
lines changed

‎MySQLdb/cursors.py

Copy file name to clipboardExpand all lines: MySQLdb/cursors.py
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,10 @@ def callproc(self, procname, args=()):
349349
"""
350350

351351
db = self._get_db()
352-
for index, arg in enumerate(args):
353-
q = "SET @_%s_%d=%s" % (procname, index,
354-
db.literal(arg))
352+
if args:
353+
fmt = '@_{0}_%d=%s'.format(procname)
354+
q = 'SET %s' % ','.join(fmt % (index, db.literal(arg))
355+
for index, arg in enumerate(args))
355356
if isinstance(q, unicode):
356357
q = q.encode(db.encoding, 'surrogateescape')
357358
self._query(q)

0 commit comments

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