Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #42 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

find_all doesn’t have a portable way to LIMIT...OFFSET

Reported by: sam Assigned to: David
Priority: normal Milestone: 0.8
Component: ActiveRecord Version: 0.7
Severity: normal Keywords:
Cc:

Description

It’s possible to pass a string to the limit argument of find_all for specifying an offset, like "10 OFFSET 500". This is correct SQL. Though it seems MySQL does support OFFSET syntax, it only does as of version 4. MySQL isn’t compliant and needs a string like "500, 10" in previous versions. Maybe if limit is an array, AR could automatically create the correct offset SQL.

Also, limit in find_all is still subject to SQL injection (which is the only way to get the offset effect). I really think this interface should change.

Change History

10/14/04 14:19:49 changed by anonymous

I really don't think we should change rails for outdated versions of databases. If rails can be used to send correct SQL to the databases and the database chokes on it than the portability problem is on the databases side.

12/07/04 21:20:30 changed by sam

  • status changed from new to closed.
  • resolution set to fixed.

Resolved by ticket #280.