[Gambas-user] MySQL stored procedures execution problem

Benoit Minisini gambas at ...1...
Wed May 30 23:01:32 CEST 2007


On mardi 29 mai 2007, Leandro Anthonioz Blanc wrote:
> Hi, I have a problem with MySQL stored procedures that returns results.
> FIRST time I execute a line like this: hResult = hConn.Exec(“CALL
> MyStoredProcedure()”)  
 line works OK. However, NEXT time I try to execute
> same line, this error occurs: “Query failed: Commands out of sync; you
> can’t run this command now”  I found this information in MySQL
> documentation: If you get Commands out of sync; you can't run this command
> now in your client code, you are calling client functions in the wrong
> order. This can happen, for example, if you are using mysql_use_result()
> and try to execute a new query before you have called mysql_free_result().
> It can also happen if you try to execute two queries that return data
> without calling mysql_use_result() or mysql_store_result() in between. To
> avoid this problem, I close and reopen connection before execute a stored
> procedure, and works, but is not a good workaround. I edit “do_query”
> function in gb.db.mysql/src/main.c file, attempting to include a
> “mysql_free_result(res);” instruction that solves the problem, but I
> couldn’t solve it. Anybody can help me please? Thank you very much.
>

Can you try my fix in the latest development SVN revision ?

-- 
Benoit Minisini




More information about the User mailing list