[Gambas-user] MySQL stored procedures execution problem

Leandro Anthonioz Blanc leandro_anthonioz at ...43...
Tue May 29 17:08:20 CEST 2007


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.
  
       
---------------------------------
Yahoo! oneSearch: Finally,  mobile search that gives answers, not web links. 



More information about the User mailing list