|
1 | 1 | # -*- coding: utf-8 -*-
|
2 | 2 | # MySQL Connector/Python - MySQL driver written in Python.
|
3 |
| -# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. |
| 3 | +# Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. |
4 | 4 |
|
5 | 5 | # MySQL Connector/Python is licensed under the terms of the GPLv2
|
6 | 6 | # <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
|
|
29 | 29 | import unittest
|
30 | 30 |
|
31 | 31 | from mysql.connector import errors, errorcode
|
| 32 | +from .. import PY2 |
32 | 33 |
|
33 | 34 | import tests
|
34 | 35 |
|
@@ -516,6 +517,28 @@ def tests_execute_multi(self):
|
516 | 517 | cur.close()
|
517 | 518 | self.cnx.rollback()
|
518 | 519 |
|
| 520 | + cur = self._get_cursor(self.cnx) |
| 521 | + cur.execute("DROP PROCEDURE IF EXISTS multi_results") |
| 522 | + procedure = ( |
| 523 | + "CREATE PROCEDURE multi_results () " |
| 524 | + "BEGIN SELECT 1; SELECT 'ham'; END" |
| 525 | + ) |
| 526 | + cur.execute(procedure) |
| 527 | + stmt = "CALL multi_results()" |
| 528 | + if not PY2: |
| 529 | + stmt = b"CALL multi_results()" |
| 530 | + exp_result = [[(1,)], [(u'ham',)]] |
| 531 | + results = [] |
| 532 | + for result in cur.execute(stmt, multi=True): |
| 533 | + if result.with_rows: |
| 534 | + self.assertEqual(stmt, result._executed) |
| 535 | + results.append(result.fetchall()) |
| 536 | + |
| 537 | + self.assertEqual(exp_result, results) |
| 538 | + cur.execute("DROP PROCEDURE multi_results") |
| 539 | + |
| 540 | + cur.close() |
| 541 | + |
519 | 542 |
|
520 | 543 | class CExtMySQLCursorBufferedTests(tests.CMySQLCursorTests):
|
521 | 544 |
|
|
0 commit comments