Good point. That makes an excellent case actually for why it would be good for Reactor to abstract that functionality.

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Marlon Moyer
Sent: Friday, February 10, 2006 2:49 PM
To: [email protected]
Subject: Re: Reactor For CF query.setMaxRows()

 

actually, you have to do something like this to mimic limit and offset

select * from (select top (limit) * from (select top (offset + limit) from sometable order by col1 asc, col2 desc, col3 asc) order by col1 desc, col2 asc, col3 desc)) order by col1 asc, col2 desc, col3 asc

it gets confusing and ugly quick.


On 2/10/06, Seth Petry-Johnson <[EMAIL PROTECTED] > wrote:

Is MySql's LIMIT similar to MS SQL's TOP keyword?

 

i.e. select top 5 blahID, blahName from someTable order by blahID to return 5 rows with the lowest IDs?

 

On 2/10/06, Michael Lantz <[EMAIL PROTECTED] > wrote:

I have to agree that some sort of functionality like that would be great for
pagination, and, short of writing your own query and bypassing Reactor, I
don't see how this could be done within the framework as it now stands.

I do believe that LIMIT/OFFSET is mysql specific, though...

Michael

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Chris
Blackwell
Sent: Friday, February 10, 2006 11:07 AM
To: [email protected]
Subject: Reactor For CF query.setMaxRows()

>From looking at the query debug output it looks like setMaxRows() function
sets the maxrows attribute of the <cfquery> tag, as I don't see LIMIT in the
sql.

When displaying large paginated recordsets i like to use the power of
MySQL's LIMIT clause and provide an offset so I only get back the rows I
will be displaying, like...

SELECT * FROM tblName
LIMIT 10 OFFSET 20

I don't know whether this works in other DB's.

So is there anyway to implement this in Reactor?  Seems to me that the query
object would need a setOffset() method, but that might break in dbs other
than mysql.

If this is "application functionality that is needed by the developer that
may seem, to the developer, like it should be a job of the framework itself"
then feel free to shoot me down ;)  At the moment I'm still trying to get my
head around Reactor so working out where it should end and my application
starts is a little blurry atm.

Chris






--
Marlon

Reply via email to