You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "David Crossley (JIRA)" <ji...@apache.org> on 2006/03/01 07:26:45 UTC

[jira] Updated: (COCOON-649) [PATCH] Made SQLTransformer paginatable

     [ http://issues.apache.org/jira/browse/COCOON-649?page=all ]

David Crossley updated COCOON-649:
----------------------------------

    Bugzilla Id:   (was: 19138)
     Other Info: [Patch available]
    Description: 
Hi,

Thanks to idea and code from Irv Salisbury III, I made some
changes to src/blocks/database/.../transformation/SQLTransformer
and made it "Paginator"able.

With this patch, you can set page-size and current-page via
the sitemap and have paging done via result set controls rather
than filtering through a Paginator Transformer.

While that transformer works, in the case of a database query,
it just seemed a tad wasteful not to do the paging at a lower
level.

I have made some changes to the Paginator code as well to allow
calls from PagingSQLTransformer to spit out paging related tags.
This will ease any transition of switching from using the
paginator transformer to using this PagingSQLTransformer.

Before using PagingSQLTransformer,

  <map:match pattern="{1}/view/Show[:punct:]*([0-9]*)[:punct:]*" type="regexp">
    <map:generate src="xsp/view/display-all.xsp"/>
    <map:transform type="sql">
      <map:parameter name="use-connection" value="photo"/>
      <map:parameter name="show-nr-of-rows" value="true"/>
    </map:transform>
    <map:transform type="paginator" src="pagesheets/display.xml"/>
    <map:transform src="stylesheets/view/display-all.xsl"/>
    <map:act type="request">
    <map:transform src="stylesheets/page/simple-page2html.xsl">
      <map:parameter name="app-context" value="{context}"/>
      <map:parameter name="requestURI" value="{requestURI}"/>
    </map:transform>
    </map:act>
    <map:transform src="stylesheets/page/simple-pagination.xsl"/>
    <map:serialize/>
  </map:match>
  
Using PagingSQLTransformer,

  <map:match pattern="{1}/view/Show[:punct:]*([0-9]*)[:punct:]*" type="regexp">
    <map:generate src="xsp/view/display-all.xsp"/>
    <map:transform type="sql">
      <map:parameter name="use-connection" value="photo"/>
      <map:parameter name="show-nr-of-rows" value="true"/>
      <map:parameter name="page-size" value="10"/>
      <map:parameter name="current-page" value="{1}"/>
      <map:parameter name="pagesheet-source" value="pagesheets/display.xml"/>
    </map:transform>
    <map:transform src="stylesheets/view/display-all.xsl"/>
    <map:act type="request">
    <map:transform src="stylesheets/page/simple-page2html.xsl">
      <map:parameter name="app-context" value="{context}"/>
      <map:parameter name="requestURI" value="{requestURI}"/>
    </map:transform>
    </map:act>
    <map:transform src="stylesheets/page/simple-pagination.xsl"/>
    <map:serialize/>
  </map:match>

I made some patch to the Paginator code that should fix bug
#13865.

Further changes to the Paginator code now allows, multiple
range-links too.

One of the inconsistency (maybe) from all these changes is that
I make it so that "page-size" is configured for the SQLTransformer
and the pagesheet/rules/count/num is ignored. I have not figure
out a way to use both easily. I will have to do some more thinking
on that. What is easier to understand? Comments?

This is my first time contributing in a "patch" sort of way to
any open source project, so excuse me if I get any procedure
wrong.

Boon

  was:
Hi,

Thanks to idea and code from Irv Salisbury III, I made some
changes to src/blocks/database/.../transformation/SQLTransformer
and made it "Paginator"able.

With this patch, you can set page-size and current-page via
the sitemap and have paging done via result set controls rather
than filtering through a Paginator Transformer.

While that transformer works, in the case of a database query,
it just seemed a tad wasteful not to do the paging at a lower
level.

I have made some changes to the Paginator code as well to allow
calls from PagingSQLTransformer to spit out paging related tags.
This will ease any transition of switching from using the
paginator transformer to using this PagingSQLTransformer.

Before using PagingSQLTransformer,

  <map:match pattern="{1}/view/Show[:punct:]*([0-9]*)[:punct:]*" type="regexp">
    <map:generate src="xsp/view/display-all.xsp"/>
    <map:transform type="sql">
      <map:parameter name="use-connection" value="photo"/>
      <map:parameter name="show-nr-of-rows" value="true"/>
    </map:transform>
    <map:transform type="paginator" src="pagesheets/display.xml"/>
    <map:transform src="stylesheets/view/display-all.xsl"/>
    <map:act type="request">
    <map:transform src="stylesheets/page/simple-page2html.xsl">
      <map:parameter name="app-context" value="{context}"/>
      <map:parameter name="requestURI" value="{requestURI}"/>
    </map:transform>
    </map:act>
    <map:transform src="stylesheets/page/simple-pagination.xsl"/>
    <map:serialize/>
  </map:match>
  
Using PagingSQLTransformer,

  <map:match pattern="{1}/view/Show[:punct:]*([0-9]*)[:punct:]*" type="regexp">
    <map:generate src="xsp/view/display-all.xsp"/>
    <map:transform type="sql">
      <map:parameter name="use-connection" value="photo"/>
      <map:parameter name="show-nr-of-rows" value="true"/>
      <map:parameter name="page-size" value="10"/>
      <map:parameter name="current-page" value="{1}"/>
      <map:parameter name="pagesheet-source" value="pagesheets/display.xml"/>
    </map:transform>
    <map:transform src="stylesheets/view/display-all.xsl"/>
    <map:act type="request">
    <map:transform src="stylesheets/page/simple-page2html.xsl">
      <map:parameter name="app-context" value="{context}"/>
      <map:parameter name="requestURI" value="{requestURI}"/>
    </map:transform>
    </map:act>
    <map:transform src="stylesheets/page/simple-pagination.xsl"/>
    <map:serialize/>
  </map:match>

I made some patch to the Paginator code that should fix bug
#13865.

Further changes to the Paginator code now allows, multiple
range-links too.

One of the inconsistency (maybe) from all these changes is that
I make it so that "page-size" is configured for the SQLTransformer
and the pagesheet/rules/count/num is ignored. I have not figure
out a way to use both easily. I will have to do some more thinking
on that. What is easier to understand? Comments?

This is my first time contributing in a "patch" sort of way to
any open source project, so excuse me if I get any procedure
wrong.

Boon


> [PATCH] Made SQLTransformer paginatable
> ---------------------------------------
>
>          Key: COCOON-649
>          URL: http://issues.apache.org/jira/browse/COCOON-649
>      Project: Cocoon
>         Type: Improvement
>   Components: - Components: Avalon
>     Versions: 2.1.8
>  Environment: Operating System: All
> Platform: All
>     Reporter: Boon Hian Tek
>     Assignee: Cocoon Developers Team
>     Priority: Minor
>  Attachments: contrib-2003_37_11.tar.gz, sql_transformer_2003_04_28.tar.gz, sqlpatch.tar, sqltransformer.patch.tar.gz
>
> Hi,
> Thanks to idea and code from Irv Salisbury III, I made some
> changes to src/blocks/database/.../transformation/SQLTransformer
> and made it "Paginator"able.
> With this patch, you can set page-size and current-page via
> the sitemap and have paging done via result set controls rather
> than filtering through a Paginator Transformer.
> While that transformer works, in the case of a database query,
> it just seemed a tad wasteful not to do the paging at a lower
> level.
> I have made some changes to the Paginator code as well to allow
> calls from PagingSQLTransformer to spit out paging related tags.
> This will ease any transition of switching from using the
> paginator transformer to using this PagingSQLTransformer.
> Before using PagingSQLTransformer,
>   <map:match pattern="{1}/view/Show[:punct:]*([0-9]*)[:punct:]*" type="regexp">
>     <map:generate src="xsp/view/display-all.xsp"/>
>     <map:transform type="sql">
>       <map:parameter name="use-connection" value="photo"/>
>       <map:parameter name="show-nr-of-rows" value="true"/>
>     </map:transform>
>     <map:transform type="paginator" src="pagesheets/display.xml"/>
>     <map:transform src="stylesheets/view/display-all.xsl"/>
>     <map:act type="request">
>     <map:transform src="stylesheets/page/simple-page2html.xsl">
>       <map:parameter name="app-context" value="{context}"/>
>       <map:parameter name="requestURI" value="{requestURI}"/>
>     </map:transform>
>     </map:act>
>     <map:transform src="stylesheets/page/simple-pagination.xsl"/>
>     <map:serialize/>
>   </map:match>
>   
> Using PagingSQLTransformer,
>   <map:match pattern="{1}/view/Show[:punct:]*([0-9]*)[:punct:]*" type="regexp">
>     <map:generate src="xsp/view/display-all.xsp"/>
>     <map:transform type="sql">
>       <map:parameter name="use-connection" value="photo"/>
>       <map:parameter name="show-nr-of-rows" value="true"/>
>       <map:parameter name="page-size" value="10"/>
>       <map:parameter name="current-page" value="{1}"/>
>       <map:parameter name="pagesheet-source" value="pagesheets/display.xml"/>
>     </map:transform>
>     <map:transform src="stylesheets/view/display-all.xsl"/>
>     <map:act type="request">
>     <map:transform src="stylesheets/page/simple-page2html.xsl">
>       <map:parameter name="app-context" value="{context}"/>
>       <map:parameter name="requestURI" value="{requestURI}"/>
>     </map:transform>
>     </map:act>
>     <map:transform src="stylesheets/page/simple-pagination.xsl"/>
>     <map:serialize/>
>   </map:match>
> I made some patch to the Paginator code that should fix bug
> #13865.
> Further changes to the Paginator code now allows, multiple
> range-links too.
> One of the inconsistency (maybe) from all these changes is that
> I make it so that "page-size" is configured for the SQLTransformer
> and the pagesheet/rules/count/num is ignored. I have not figure
> out a way to use both easily. I will have to do some more thinking
> on that. What is easier to understand? Comments?
> This is my first time contributing in a "patch" sort of way to
> any open source project, so excuse me if I get any procedure
> wrong.
> Boon

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira