Right, but currently, people rely on this behavior.
Not b/c they believe that limit(0) should return Zero rows, but because
in our loosely-typed world, limit(null) or limit(false) means return
everything.
Unfortunately, limit() current casts everything to an integer, so
someone calling limit(null) is the same as calling limit(0).
limit(null) semantically DOES look like "don't set a limit", and that
would be the BC break here.
Trust me, I understand the argument both ways, and I see the bad
behavior in the current implementation.. but I think we have our hands
tied here until ZF2 which is right around the corner.
Since there is an easy userland workaround for this (to those who see it
as bad behavior.. (the if($count > 0) { $select->limit($count) } trick),
I think waiting on a fix to this is the right path.
Cheers,
-ralph
On 10/5/10 9:35 AM, Hector Virgen wrote:
FETCH FIRST 0...
SELECT TOP 0...
SELECT... LIMIT 0
I'm having trouble believing that anyone would expect more than zero rows to
be returned.
I agree with you about throwing an exception for limit zero, but since we
can't have a BC break, the next best thing IMO would be to honor the
developer's intentions as much as possible.
--
Hector Virgen
Sent from my Droid X