Open omagid-crp opened 4 years ago
In the case of options[:format] == :resultset
, you're not explicitly iterating the result object like you are with the other conditions. That is possibly one source of the problem. Try this
case options[:format]
when :resultset
+ # or, return result.do
+ return result.to_a
- return result
when :hash
results = result.each
Thanks for your comment. We actually don't use that option anywhere in our codebase. I probably should have mentioned that or just left it out. 99% of the calls to this method use the option :hash
and the others don't pass any option at all.
Environment
Operating System
TinyTDS Version and Information The
ttds-tsql
command is not found, even though we're using TinyTds v.2.1.2.tsql -C
outputs:FreeTDS Version Version: freetds v1.1.21
Description
We use TinyTds to call stored procedures from Rails. Lately, we've been getting a lot of these errors: "Attempt to initiate a new Adaptive Server operation with results pending." I've looked through past issues and scoured the internet, but I can't seem to diagnose the problem. Our implementation of Passenger isn't multi-threaded, so that shouldn't be an issue.
My latest best guess is that our
procedure_results
method starts by checking if the client is either nil or bad, and only if one or the other is the case does it open a new connection. But that would seem to allow for the possibility that the client is not nil, and not bad, but occupied waiting on pending results. Here's how the method starts:Am I right that this is problematic? If not, any other ideas?
Here are our "new_connection" and "procedure_results" methods in their entirety: