On Saturday, August 3, 2013 2:32:00 PM UTC-7, Keith Moore wrote: > I think I might have found a bug with the limit method when a range is > passed in. > > For the record, my test environment is using jdbc-sqlite3 (3.7.2.1) with > jRuby 1.7.4 > > DB[:items].limit(10..20) # SELECT * FROM items LIMIT 11 OFFSET 10 > > Seems to me that the offset should be 9 here. From my tests, it looks > like this is a bug. > I monkey patched the 3.48 version which passed all of my tests. >
I suppose it depends on whether you think it should be 1-indexed or 0-indexed. Historically, it has been 0-indexed, and changing it would break existing code. The RDoc describes the behavior of the method, so this isn't a bug. I think the current behavior makes more sense than what your patch proposes, since ruby generally uses 0-based indexing. For example: DB[:items].limit(10..20).all == DB[:items].all.values_at(10..20) I would have tested the patch and generated a pull request but I cant > figure out how to run the internal tests. > rake # http://sequel.rubyforge.org/rdoc/files/doc/testing_rdoc.html 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 http://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/groups/opt_out.
