Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 18563 invoked from network); 27 Mar 2006 13:57:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 27 Mar 2006 13:57:17 -0000 Received: (qmail 96926 invoked by uid 500); 27 Mar 2006 13:57:13 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 96589 invoked by uid 500); 27 Mar 2006 13:57:11 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: users@cocoon.apache.org List-Id: Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 96578 invoked by uid 99); 27 Mar 2006 13:57:11 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Mar 2006 05:57:11 -0800 X-ASF-Spam-Status: No, hits=0.6 required=10.0 tests=HTML_MESSAGE,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [193.82.99.130] (HELO westsussex.gov.uk) (193.82.99.130) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Mar 2006 05:57:10 -0800 Received: from westsussex.gov.uk ([192.168.88.24]) by wfwchich07.westsussex.gov.uk with ESMTP id <119330>; Mon, 27 Mar 2006 14:56:27 +0100 Received: from hubserver01.westsussex.gov.uk ([172.16.33.61]) by wfwchich01.westsussex.gov.uk with ESMTP id <119124>; Mon, 27 Mar 2006 14:56:19 +0100 In-Reply-To: <20060327132612.11238.qmail@web34712.mail.mud.yahoo.com> To: users@cocoon.apache.org Subject: Re: Handling SQL Transformer exceptions MIME-Version: 1.0 X-Mailer: Lotus Notes Release 6.5.5 November 30, 2005 Message-ID: From: Warrell.Harries@westsussex.gov.uk Date: Mon, 27 Mar 2006 14:54:35 +0100 X-MIMETrack: Serialize by Router on HubServer01/WSCC at 27/03/2006 14:53:43, Serialize complete at 27/03/2006 14:53:43 Content-Type: multipart/alternative; boundary="=_alternative 004C68FD8025713E_=" X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --=_alternative 004C68FD8025713E_= Content-Type: text/plain; charset="US-ASCII" Hi Oleg, I don't think that you can call this a 'bug in Cocoon'! Do you really mean a Cocoon 2.0 version or just generally version 2 of Cocoon? It seems you are building a generic DB query tool so I suppose the following is not appropriate but I would argue that this is not the desired way to use the SQLTransformer since the overall Application design should prevent any constraints ever being violated. In my view, such Constraints are fundamental rules that are there to define the parameters of the system and not just as a last line of defence or for the creation of indexes. However, to handle such Processing Exceptions in Cocoon you should take a look at :- http://cocoon.apache.org/2.1/userdocs/concepts/errorhandling.html if, of course, you are using Cocoon 2.1. Hope this helps Warrell Warrell Harries | IT Services, West Sussex County Council | Location: Northleigh House Office: +44 (0) 1243-756837 | Email: warrell.harries@westsussex.gov.uk Oleg Konovalov 27/03/2006 14:26 Please respond to users@cocoon.apache.org To cocoon list cc Subject Handling SQL Transformer exceptions Hi, I am trying to fix the bug in the Cocoon 2.0 application: - it is not handling exceptions from SQLTransformer in the GUI, need to show user an error that Insert failed. Here is an exception we often get: ERROR (2006-03-24) 15:29.31:855 [sitemap.transformer.sql] (/myapp) Thread-11/SQLTransformer$Query: Caught a SQLException java.sql.SQLException: ORA-00001: unique constraint (MBRDEV.UKC_ASSOC_COT) violated at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) Here is a simplified version of my XSL: <xsl:value-of select='$table'/><xsl:text> modification</xsl:text> insert into ......... ERROR: Can not insert the row into the database (not recorded) .... Am I doing it right and in correct place ("This is the code...") ? For some reason it doesn't seem to work (maybe that condition is false: "count(//sql:error[1]) > 0" ?) Sorry for the newbie question. Any help is very appreciated. Thank you in advance, Oleg. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org -- This e-mail and any attachments are confidential and intended solely for the persons addressed. If it has come to you in error please reply to advise us but you should not read it, copy it, show it to anyone else nor make any other use of its content. West Sussex County Council takes steps to ensure e-mails and attachments are virus-free but you should carry out your own checks before opening any attachment. --=_alternative 004C68FD8025713E_= Content-Type: text/html; charset="US-ASCII"
Hi Oleg,

I don't think that you can call this a 'bug in Cocoon'! Do you really mean a Cocoon 2.0 version or just generally version 2 of Cocoon?

It seems you are building a generic DB query tool so I suppose the following is not appropriate but I would argue that this is not the desired way to use the SQLTransformer since the overall Application design should prevent any constraints ever being violated. In my view, such Constraints are fundamental rules that are there to define the parameters of the system and not just as a last line of defence or for the creation of indexes. However,  to handle such Processing Exceptions in Cocoon you should take a look at :-

http://cocoon.apache.org/2.1/userdocs/concepts/errorhandling.html

if, of course, you are using Cocoon 2.1.

Hope this helps

Warrell
Warrell Harries | IT Services, West Sussex County Council | Location: Northleigh House
Office: +44 (0) 1243-756837
| Email: warrell.harries@westsussex.gov.uk




Oleg Konovalov <olegkon@yahoo.com>

27/03/2006 14:26
Please respond to
users@cocoon.apache.org

To
cocoon list <users@cocoon.apache.org>
cc
Subject
Handling SQL Transformer exceptions





Hi,

I am trying to fix the bug in the Cocoon 2.0 application:
- it is not handling exceptions from SQLTransformer in the GUI,
need to show user an error that Insert failed.

Here is an exception we often get:
ERROR   (2006-03-24) 15:29.31:855   [sitemap.transformer.sql] (/myapp) Thread-11/SQLTransformer$Query: Caught a SQLException
java.sql.SQLException: ORA-00001: unique constraint (MBRDEV.UKC_ASSOC_COT) violated
   at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)

Here is a simplified version of my XSL:
<xsl:template match="/">
   <page>
       <title><xsl:value-of select='$table'/><xsl:text> modification</xsl:text></title>
       <content>
           <xsl:apply-templates/>
       </content>
   </page>
</xsl:template>

<xsl:template name='doInsert'>
   <xsl:param name='row'/>
   <xsl:param name='table'/>
   
   <sql:execute-query>
       <sql:query>
           <xsl:text>insert into </xsl:text>
           <xsl:value-of select='$table'/>
           .........
       </sql:query>
   </sql:execute-query>
   
   <!-- This is the code I added to handle that exception which is supposed to show it to the user -->
   <xsl:if test="count(//sql:error[1]) > 0">  
       <xsl:call-template name='buildErrorMessage'>
           <xsl:with-param name='row' select='.'/>
           <xsl:with-param name='message'><xsl:text>ERROR: Can not insert the row into the database (not recorded)</xsl:text></xsl:with-param>
       </xsl:call-template>            
   </xsl:if>
   
</xsl:template>
....

Am I doing it right and in correct place ("This is the code...") ?

For some reason it doesn't seem to work (maybe that condition is false: "count(//sql:error[1]) > 0"  ?)


Sorry for the newbie question. Any help is very appreciated.


Thank you in advance,
Oleg.




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




--
This e-mail and any attachments are confidential and intended solely for the persons addressed. If it has come to you in error please reply to advise us but you should not read it, copy it, show it to anyone else nor make any other use of its content.   West Sussex County Council takes steps to ensure e-mails and attachments are virus-free but you should carry out your own checks before opening any attachment.
--=_alternative 004C68FD8025713E_=--