Bug #77548 statements get out of synch with result sets
Submitted: 29 Jun 2015 18:21 Modified: 21 Nov 2023 23:38
Reporter: Michael Grazebrook Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / Python Severity:S2 (Serious)
Version:2.0.4 OS:Any (Windows)
Assigned to: CPU Architecture:Any

[29 Jun 2015 18:21] Michael Grazebrook
Description:
When calling several stored procedures in a script, the statement gets out of synch with the result. The reported code doesn't match the results. The results are correct.

There is no reasonable work-around I can think of for this,  but I hesitate to record it as critical.

How to repeat:
SQL:

drop procedure if exists tmp_test_synch;

create procedure tmp_test_synch(val integer)
select val;

Python code:

sql = """
-- one
call tmp_test_synch(1);

-- two
call tmp_test_synch(2);

-- three
call tmp_test_synch(3);

"""

for result in cur.execute(sql, multi=True):
    if result.with_rows:
        print("\n****statement****\n", result.statement[:120])
        print( result.fetchall() )

Output:

****statement****
 -- one
call tmp_test_synch(1)
[(1,)]

****statement****
 -- three
call tmp_test_synch(3)
[(2,)]

****statement****
 -- one
call tmp_test_synch(1)
[(3,)]

Suggested fix:
Obvious, I hope!
[8 Jul 2015 11:01] MySQL Verification Team
Hello Michael,

Thank you for the report and test case.

Thanks,
Umesh
[21 Nov 2023 23:38] Philip Olson
Posted by developer:
 
Fixed as of the upcoming MySQL Connector/Python 8.3.0 release, and here's the proposed changelog entry from the documentation team:

Fixed multi=True usage when the query contained either code comments or
stored procedures.

Thank you for the bug report.