This still seems to be an issue for me running 
2.9.5-stable+timestamp.2014.03.16.02.35.39. 
I tried both mysqldb and the default pymysql driver. I want to use a stored 
procedure to run a lengthy query that is run quite often by my application. 
This behavior should be easily reproducable using a simple stored procedure:

CREATE PROCEDURE `SimpleSP`()BEGIN
SELECT 'hello';END


Running "db.executesql('CALL SimpleSP()')" twice in a row on command line 
with -S -M options:
>>> db.executesql('CALL SimpleSP()')
((u'hello',),)
>>> db.executesql('CALL SimpleSP()')
None

This behavior alternates back and forth between these two results.

With mysqldb on the second and all subsequent tries I get:
ProgrammingError: (2014, "Commands out of sync; you can't run this command 
now")

Even worse though is that you can no longer run db(query).select() type 
commands after just one CALL. Something in the DAL is getting screwed up 
because when I try to run a normal query after running the CALL, I get 
results I should have received from the CALL, or no results, or "TypeError: 
'NoneType' object is not iterable" and other strange artifacts.

The mysqldb manual <http://mysql-python.sourceforge.net/MySQLdb.html> 
states:

*Compatibility note: It appears that the mere act of executing the CALL 
statement produces an empty result set, which appears after any result sets 
which might be generated by the stored procedure. Thus, you will always 
need to use nextset() to advance result sets.*

So it appears that maybe executesql() is not handling the multiple result 
sets gracefully? Is there any resolution to this issue?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to