luasql icon indicating copy to clipboard operation
luasql copied to clipboard

Can not fetch result after calling procedure

Open ovoshlook opened this issue 9 years ago • 1 comments

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.

ovoshlook avatar Dec 31 '15 19:12 ovoshlook

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

tomasguisasola avatar Jan 04 '16 13:01 tomasguisasola