Bug #77548 statements get out of synch with result sets
Submitted: 29 Jun 2015 18:21 Modified: 8 Jul 2015 11:01
Reporter: Michael Grazebrook Email Updates:
Status: Verified 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