I've been getting similar errors and switching from Dataset#each to 
Dataset#all resolved some of them. Could you elaborate on why #each causes 
the errors and #all does not?

Thank you.

On Thursday, July 21, 2016 at 12:15:23 AM UTC-7, Jeremy Evans wrote:
>
> On Thursday, July 21, 2016 at 12:10:05 AM UTC-7, R Bakhshi wrote:
>>
>> Hi there,
>>
>> I am using Sequel 4.33 and tiny_tds 1.0.4.
>>
>> This statement:
>> class MyModel < Sequel::Model
>>   def validate
>>     super
>>     if not_disabled?
>>       validates_unique [:name, :client_id], message: Sequel.lit('Name is 
>> already taken') do |ds|
>>         ds.exclude(disabled: true)
>>       end
>>     end
>>   end
>> end
>>
>> Fails with:
>>
>> Sequel::DatabaseDisconnectError: TinyTds::Error: Attempt to initiate a 
>> new Adaptive Server operation with results pending
>>
>> Looks like it cannot run query generated by the block.
>>
>> Is there anyway to work around this?
>>
>>
> Without a full backtrace and self contained example code, I can only guess 
> what the problem is.  If I had to guess, you are calling Model#save inside 
> of a Dataset#each block, which causes exceptions like the one you received 
> on most adapters.  If that's the case, try switching to using Dataset#all 
> instead of Dataset#each.  If that's not the case, please post a minimal 
> self-contained example and a full backtrace.
>
> Thanks,
> Jeremy
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to