[Devel] MySQL and stored procedures

Stefan Prelle s.prelle at broadnet.de
Mon Jan 8 17:36:05 CET 2007


Hi all,

Am Montag, den 08.01.2007, 11:18 +0100 schrieb Stefan Prelle:
> Called from within the LCR module, the first request is working fine.,
> the results are processed as expected. When a second call is processed,
> the query command fails:
> submit_query: Commands out of sync; you can't run this command now
> 
> Digging a bit into it, I found this
> http://dev.mysql.com/doc/refman/5.1/en/commands-out-of-sync.html
> 
> As far as I understand the database layer, "mysql_store_result()" is
> called any time a query is issued successfully, so this effect must be
> related especially to stored procedures. Any ideas?

Thanks to a hint from a collegue, I made a minor modification to
mysql/dbase.c in the function db_mysql_store_result(). I added

        while (mysql_more_results(CON_CONNECTION(_h))) {
          mysql_next_result(CON_CONNECTION(_h));
        }

just before the
        return 0;

and that did the trick for the "Commands out of sync" issue.

Stefan





More information about the Devel mailing list