lunarmodules / luasql

LuaSQL is a simple interface from Lua to a DBMS.
http://lunarmodules.github.io/luasql
539 stars 191 forks source link

Can not fetch result after calling procedure #41

Open ovoshlook opened 8 years ago

ovoshlook commented 8 years ago

local res=assert(con:execute("CALL Procedure_name('"..parameter.."')")) while row do
row = res:fetch ({}, "a") end

After this calling another query and see: LuaSQL: error executing query. MySQL: Commands out of sync; you can't run this command now

This error means that driver can not free result and next query can not be executed, This happens only with procedures.

I tried res:close() but it is not works for this too. So as I cnow it automaticly closes when fetched null value.

tomasguisasola commented 8 years ago

Hi

On 2015-12-31 17:05, ovoshlook wrote:

local res=assert(con:execute("CALL Procedure_name('"..parameter.."')")) while row do

row = res:fetch ({}, "a") end

After this call another query and see: LuaSQL: error executing query. MySQL: Commands out of sync; you can't run this command now

This error means that driver can not free result and next query can not be executed, This happens only with procedures.

I tried res:close() but it is not works for this too. So as I cnow it automaticly closes when fetched null value.

Reply to this email directly or view it on GitHub [1].

*

Links:

[1] https://github.com/keplerproject/luasql/issues/41

LuaSQL drivers are not designed to work that way. I think they will have to be adapted...

Regards, Tomás