Greetings, Just to be clear, the tweak to 'single_record' that worked was going from this:
def single_record clone(:limit=>1).each {|r| return r} nil end to this: def single_record record = nil clone(:limit=>1).each {|r| record = r; return r} record end I left the 'return r' in place, because it keeps the unwinding codepath as similar to the MRI case as possible. Or you could monkey-patch that in your own code as follows: module Sequel class Dataset def single_record record = nil clone(:limit=>1).each {|r| record = r; return r} record end end end Adding that to the gist, after the requires makes it work. I'll fork the gist and add that code, to demonstrate. Hope that formats okay, and helps! -- Morgan Schweers On Sat, Apr 9, 2011 at 4:55 PM, Morgan Schweers <cyber...@gmail.com> wrote: > Greetings, > It is a pretty reduced test case, in fact. > > I dug into it briefly, but it quickly went over my head... It's clear > there's a difference in how the stack is unwound when a block return happens > eight-ish levels down, between the two. It looks like in MRI code that is > later in methods that are being unwound is _NOT_ executed, but in MacRuby, > that code _IS_ being executed. I can't seem to make an example, although > that's what I'm seeing when I run the gist provided with a ton of debugging > in place. > > What I'm seeing is that in > ${SEQUEL_GEM}/lib/sequel/dataset/action.rb#single_record both the 'return' > in the block, and the nil at the end are being executed, when only one > should be. (In MRI 1.9.2, only the return in the block is executed, not the > nil at the end.) That's pretty much where I lost the plot; I don't know why > it's behaving differently right there. > > A tiny tweak to #single_record made it work, but it does look like it's a > MacRuby issue. > > -- Morgan > > > On Sat, Apr 9, 2011 at 7:58 AM, Eloy Duran <eloy.de.en...@gmail.com>wrote: > >> If it works on MRI but not on MacRuby it's a bug. Unless someone >> with MacRuby +Sequel experience can give you a workaround, the only course >> of action would be to create a simple self contained reduction, by hunting >> down the code in Sequel that's broken on MacRuby and create a ticket with >> the reduction. >> >> HTH >> >> On 9 apr 2011, at 02:55, Daniel Westendorf wrote: >> >> Hi all, >> >> I'm not able to query a Sqlite database using MacRuby and Sequel. Consider >> the following gist: https://gist.github.com/910989 >> >> macruby => 0.10 >> sequel => 3.22.0 >> sqlite3 => 1.3.3 >> >> I get a response from the the db when I select ALL the rows, but not when >> I query for one record. It works with MRI 1.9.2. Am I doing something wrong, >> or is this a bug? Does anyone have some suggestions on what I should do to >> troubleshoot this or work around it? >> >> Thanks, >> >> Daniel >> >> >> _______________________________________________ >> MacRuby-devel mailing list >> MacRuby-devel@lists.macosforge.org >> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >> >> >> >> _______________________________________________ >> MacRuby-devel mailing list >> MacRuby-devel@lists.macosforge.org >> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >> >> >
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel