The example I am thinking of is an app could very well have millions of rows, and if you did happen to pass a zero you would most probably end up killing the server with an out of memory error, or timeout issues... and thus bring you app crashing down.
Daniel. 2010/10/3 Daniel Latter <[email protected]> > Hi, > > I know what your saying but my point is that, is this intended behaviour to > return a number so large if a zero happend to be passed.? > > Thanks > Daniel. > > 2010/10/3 Valeriy Yatsko <[email protected]> > > Good day >> >> > dont know if this is a bug or not but if you pass the following >> parameters >> > to the limit method on select object like so: >> > >> > ->limit(0, 10); >> > >> > It produces the following SQL: >> > >> > LIMIT 2147483647 OFFSET 10 >> > >> > now i know you should vaidate the limit val beforehand but this could >> > potentially kill someones app? >> >> >> In Zend_Db_Select, you can use the limit() method to specify the count of >> rows and the number of rows to skip. The first argument to this method is >> the desired count of rows. The second argument is the number of rows to >> skip. >> >> So you should use >> ->limit(10,0) >> instead. >> >> -- >> Валерий Яцко >> ______________________________________________________________________ >> [email protected] | http://www.artlebedev.ru >> >> >
