Re: Extending "Limit" support

From: Date: Mon, 26 Nov 2001 13:17:35 +0000
Subject: Re: Extending "Limit" support
References: 1 2 3 4  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-3107@lists.php.net to get a copy of this message
"Stig S. Bakken" wrote: > > "Tomas V.V.Cox" wrote: > > > > > > > > What about having a function that sets the limit for the next query? > > > > where "next query" means: query(), execute(), executeQuery(), getAll(), > > getCol() and getAssoc(). I dropped this idea because IMO it reduces the > > readability, but there are too much functions for being adding extra > > params to all of them, so perhaps this is not bad at all. So leave > > limitQuery() for this stuff, ex: > > > > $db->limitQuery($from, $count); > > $res = $db->query($sql); > > +1 > > >Or > > > simply drop limitQuery and parse the query? > > > > > > > Don't catch you here, supply the $from/$count how? > > SELECT foo FROM bar LIMIT 20 (from=0 count=20) > > or > > SELECT foo FROM bar LIMIT 100 20 (from=100 count=20) > > In MySQL this works out of the box, in the others, modifyQuery() parses > out the LIMIT part, stores the from/count values temporarily in the > connection object and returns the same query without the LIMIT. > -1 IMHO too complex solution for that simple problem :-) Also probably will confuse people who don't use MySQL. To start providing our abstracted SQL instructions set are big words out of this, or not? :) Tomas V.V.Cox

« previous php.pear.dev (#3107) next »