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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]