cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Kavanagh <...@dotech.com>
Subject Re: SQLTransformer not committing Inserts
Date Tue, 16 Sep 2003 02:41:47 GMT
This is because when you end a pipeline with the map:redirect, nothing 
else gets executed. The redirect happens when the pipeline is setup. 
We've had need for similar pipelines where processing is done, then a 
redirect is performed. We wrote a redirect transformer that we'd be glad 
to contribute. It takes a url in XML or as a sitemap parameter. Instead 
of doing a redirect during setup, it does it when endDocument is called.

David

PS. coding credits to Daniel McOrmond of D.O.Tech

Dean Cording wrote:

> I am having some problems with SQLTransformer not commiting inserts 
> into a database.  I am running Cocoon 2.1 and MS SQLServer.
>  
> My pipeline looks like:
>  
>                <map:match pattern="CodeCreate-add">
>                     <map:generate type="request"/>
>                     
>                     <map:transform type="xslt" src="CodeAddTest.xsl">
>                         <map:parameter name="use-request-parameters" 
> value="true"/>
>                     </map:transform>
>                    
>                     <map:transform 
> type="sql">                              
>                         <map:parameter name="use-connection" 
> value="{global:db-connection}"/>
>                         <map:parameter name="show-nr-of-rows" 
> value="true"/>
>                         <map:parameter name="isupdate" value="true"/>
>                     </map:transform>
>                    
>                     <!-- Redirect back to the table display page -->
>                     <map:redirect-to 
> uri="CodeTableList"/>                    
>                 </map:match>
>  
>  
> And CodeAddTest.xsl looks like:
>  
> <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                               
> xmlns:sql="http://apache.org/cocoon/SQL/2.0">
>     <xsl:param name="CodeType"/>
>     <xsl:param name="CodeValue"/>
>    
>     <xsl:template match="/">
>                          
>     <page>
>         <execute-query xmlns="http://apache.org/cocoon/SQL/2.0">
>             <query> 
>                 INSERT INTO Codes (CodeType, CodeValue)
>                 VALUES ('<xsl:value-of select="$CodeType"/>', 
> '<xsl:value-of select="$CodeValue"/>')
>             </query>
>         </execute-query>
>     </page> 
>    
>     </xsl:template>
>    
> </xsl:stylesheet>
>  
> The values to be inserted are generated from a form and passed in as 
> request parameters.  At the end of the pipeline it redirects to a list 
> page that shows all of the values in the database.  The problem is 
> that the new values aren't being inserted.  If I remove the redirect 
> (and replace it with a static page for example) then the insert works 
> fine.
>  
>  
> Any ideas?
>  
>  
> Thanks,
>  
> Dean


Mime
View raw message