cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Quinn <jer...@media.demon.co.uk>
Subject Re: SQLTransformer modifications
Date Thu, 06 Mar 2003 11:01:48 GMT

On Wednesday, March 5, 2003, at 05:15 PM, Irv Salisbury III wrote:

> We'd like to use paging in our application from the result sets 
> returned from the SQLTransformer.  However, with a number of our 
> queries returning 20,000+ rows, it seems like the current Paginator 
> will not cut it for us.  This is mainly because it looks like the 
> Paginator expects all of the data to be there, which we don't want it 
> to be.

I just use the LIMIT statement in my SQL Query:


<component xmlns="http://www.xmlmind.com/xmleditor/schema/iniva">
	<meta>
		<title>formats</title>
		<desc>gets the list of audiocd format</desc>
	</meta>
	<chapter type="publications">
		<execute-query xmlns="http://apache.org/cocoon/SQL/2.0" 
xmlns:sql="http://apache.org/cocoon/SQL/2.0">
			<query name="count-paging">
				SELECT COUNT(id) AS total
				FROM library_resource
				WHERE format = 15
			</query>
		</execute-query>
		<execute-query xmlns="http://apache.org/cocoon/SQL/2.0" 
xmlns:sql="http://apache.org/cocoon/SQL/2.0">
			<query name="publications">
				SELECT id AS 'libraryid', title, YEAR(pubyear) AS 'date', 
description AS 'desc'
				FROM library_resource
				WHERE format = 15
				ORDER BY r.title
				LIMIT <substitute-value sql:name="start"/>,<substitute-value 
sql:name="count"/>
			</query>
		</execute-query>
	</chapter>
</component>


Then some XSLT turns the 'count-paging' query into a bunch of links to 
each 'page' of results.

I use InputModules in the Sitemap for the parameters 'start' and 
'count', which have default values (0 and 25) that can be overridden by 
request parameters.


hope this helps

regards Jeremy


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Mime
View raw message