Thanks, Jeremy. I haven't run into that error recently, but it looks like your patch should do the trick.
I checked the code that caused the error: db[File.read(filename)].first I was reading a file of SQL and then executing it with db[].first. I see that I should have been using db.execute() instead. Still, there should probably be a check of the r value (via your patch or similar) before freeing it. I also just want to say a big thanks for your prompt responses to this and other issues I've brought to your attention in the past. Your management of Sequel is excellent! Shawn On Jul 27, 7:58 am, Jeremy Evans <[email protected]> wrote: > On Jul 27, 12:23 am, Shawn <[email protected]> wrote: > > > > > > > sequel-3.2.0/lib/sequel/adapters/mysql.rb line 151: > > > 148: yield r if r > > 149: if conn.respond_to?(:next_result) && > > conn.next_result > > 150: loop do > > =>151: r.free > > 152: r = nil > > 153: begin > > > Sometimes fails with message "undefined method `free' for nil:NilClass > > (NoMethodError)" > > > It's checking r's value at 148, so there is the possibility that r is > > nil. But that conditional does not extend to line 151, so if r is nil, > > the method call to free will fail. > > > Please fix. > > This should only fail if conn.query(sql) returns nil or if > conn.use_result returns nil and conn.next_result is true. That seems > unlikely, but I guess it can still happen. Can you try the patch > athttp://pastie.org/560310.txt? Also, if you wouldn't mind sharing the > code that causes the error, I'd appreciate it. > > 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 -~----------~----~----~----~------~----~------~--~---
