luasql-mysql can not fetch result after calling porcedure

54 views
Skip to first unread message

Yuriy Gorlichenko

unread,
Jan 1, 2016, 3:07:17 AM1/1/16
to Kepler Developers

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.

Robert Weiss

unread,
Jan 4, 2016, 1:20:39 PM1/4/16
to kepler-...@googlegroups.com

The stored procedures that give this problem may be returning multiple values as a result of your call.  LuaSQL cannot handle this, or rather, just sees the first returned value.  If this is a number you may not even get a cursor as your result from EXECUTE.

 

In SQL Server 2005 when I run into this problem I write an encapsulating procedure that in turn calls the guest of honor and then just returns what I want from its various results.  In order to prevent receiving row counts as well as rows I start the encapsulating procedure with

 

SET NOCOUNT ON

 

Hope this helps.  No way to know whether your problem is the same as mine.

 

Robert Weiss

--
You received this message because you are subscribed to the Google Groups "Kepler Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kepler-projec...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Technical data included in this e-mail may be Export-Controlled and subject to
the Arms Export Control Act (Title 22, U.S.C., sec 2751 et seq.) or the Export
Administration Act of 1979, as amended seq.

This information or element thereof, in any form, shall not be disclosed to a
foreign person (including foreign person employees), entity, or exported from
the United States without U.S. Government authority and the express written
authorization of DCX-CHOL Enterprises, Inc.

This document may contain DCX-CHOL Enterprises, Inc. Proprietary Information and is to be used only for the purposes for which it has been supplied and is not to be duplicated or
disclosed in whole or in part without written permission from a duly authorized
representative of DCX-CHOL Enterprises, Inc.

If you feel you have received this email in error please contact the DCX-CHOL
IT Team at 310-516-1692 ext 454.
Reply all
Reply to author
Forward
0 new messages