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 1f8bd53

Browse filesBrowse files
committed
Reduce callproc roundtrip time
- Make only one single call to SET variables used as procedure parameters
1 parent a2ebbd2 commit 1f8bd53
Copy full SHA for 1f8bd53

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+
argFmt = '@_{0}_%d=%s'.format(procname)
354+
q = 'SET %s' % ','.join(argFmt % (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.