When querying MSSQL 2008 database using freetds and tinytds gem with syntax below:
db = TinyTds::Client.new(:username => ...)
select = db.execute("EXEC dbo.__stored_procedure__")
db.close
Then this line is causing ruby to crash on windows:
select.each {|x| p x}
Strange thing, when querying simple select:
select = db.execute("SELECT field FROM table")
select.each
doesn't crash - it doesn't do any loop either
It doesn't crash webrick nor rails console either.
But when I change code to:
db = TinyTds::Client.new(:username => ...)
select = []
db.execute("EXEC dbo.__stored_procedure__").each { |x|
select << x
}
db.close
Then it works like a charm (even with select).
Don't how it works on os better than windows...