SphinxQL (the SQL dialect of Sphinx), supports LIMIT clause, but only the 
oldschool type, without OFFSET. So, instead of "LIMIT 10 OFFSET 20" you 
have to write "LIMIT 20, 10". I needed to do pagination, but I couldn't use 
the pagination extension because it includes the OFFSET (for all the normal 
SQLs), so I wrote it like this:

ds.limit(Sequel.lit("#{(page - 1) * per_page}, #{per_page}"))

It would be cool if #limit would accept virtual rows, so I could write

ds.limit{[(page - 1) * per_page, per_page]} # => LIMIT 20, 10

Other than this very specific purpose of using SphinxQL, I think this would 
be useful if someone wanted to use an SQL function for LIMIT values, or any 
SQL expression (however rare it might be).

-- 
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 sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to