In a query I tried using limit(1)
; I got a WSOD, but when I use range(0,1)
I don't get any WSOD.
What is the basic difference between limit(1)
and range(0, 1)
?
Base difference is that range
is a method of SelectQuery
class, and limit
isn't.
Some APIs can extend SelectQuery and add limit
. For example $query->extendQuery('PagerDefault')
will return object of PagerDefault
class that has limit
method defined.
It may result in a syntax looking like limit()
is invoked on SelectQuery
, when in fact it isn't:
$query = db_select('node', 'n')
->fields('n')
->condition('type','problem','=')
->extend('PagerDefault')
->limit(20);