On May 6, 4:36 pm, rohit <[email protected]> wrote:
> On Mar 17, 7:31 am, Serg Podtynnyi <[email protected]> wrote:
>
> > I am not sure that it is problem with sequel or tiny_tds, because  it maybe
> > DB specific configuration etc, also I unable to compile tinytds gem from
> > github repo without modifications in sybdb.h  (i commented some parts
> > in dbdaterec  struct ) because  it defines MSDBLIB while compiling (should
> > it be defined or not?) .
> > Maybe I should wait for 0.4 release and try from scratch again.
>
> I am seeing the same error with tiny_tds version 0.4.4. Call stack
> herehttps://gist.github.com/959994. Client Ubuntu 10.04. Server
> Win2003 Enterprise / SQL Server 2008 R2
> Same test runs fine on JRuby/JDBC/Ubuntu, JRuby/JDBC/Windows, MRI/ADO/
> Windows. Have not been able to come up with a simple repro. Any clues
> in the call stack?

You didn't post your code, but from the backtrace it looks like you
are doing the equivalent of:

  Model.each do |x|
    DB[:table].all do |x|
    end
  end

You can't do that in Sequel on most adapters, because the same
connection is used for both each calls.  So you are attempting to use
the connection for a new query without finishing use of the other
query.  You either have to use all for the outer level:

  Model.all do |x|
    DB[:table].all do |x|
    end
  end

Which works because all finishes use of the connection before
yielding.  Or you can fake things with the sharding support:

  DB = Sequel.connect(..., :servers=>{:foo=>{}})
  Model.each do |x|
    DB[:table].server(:foo).all do |x|
    end
  end

which will use a separate connection because it thinks it's connecting
to a different server. Or use a separate thread:

  Model.each do |x|
    Thread.new do
      DB[:table].all do |x|
      end
    end.join
  end

which works because connections are not shared across threads.

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to