You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by jo...@apache.org on 2001/08/01 20:28:37 UTC

cvs commit: xml-xalan/java/samples/extensions/sql/ext-connection dbtest.xsl

johng       01/08/01 11:28:37

  Modified:    java/samples/extensions/sql/ext-connection dbtest.xsl
  Log:
  Added new connect method and error checking
  Submitted by: John Gentilin
  
  Revision  Changes    Path
  1.3       +19 -1     xml-xalan/java/samples/extensions/sql/ext-connection/dbtest.xsl
  
  Index: dbtest.xsl
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/samples/extensions/sql/ext-connection/dbtest.xsl,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- dbtest.xsl	2001/07/18 02:51:09	1.2
  +++ dbtest.xsl	2001/08/01 18:28:36	1.3
  @@ -9,8 +9,15 @@
   <xsl:param name="query" select="'SELECT * FROM import1'"/>
   
   <xsl:template match="/">
  -    <xsl:variable name="db" select="sql:new('extpool')"/>
  +    <xsl:variable name="db" select="sql:new()"/>
   
  +    <!-- Connect to the database with minimal error detection -->
  +		<xsl:if test="not(sql:connect($db, 'extpool'))" >
  +    	<xsl:message>Error Connecting to the Database</xsl:message>
  +      <xsl:copy-of select="sql:getError($db)/ext-error" />
  +    </xsl:if>
  +    
  +
       <HTML>
         <HEAD>
           <TITLE>List of products</TITLE>
  @@ -18,6 +25,17 @@
         <BODY>
           <TABLE border="1">
             <xsl:variable name="table" select='sql:query($db, $query)'/>
  +          
  +          <!-- 
  +          	Let's include Error Checking, the error is actually stored 
  +            in the connection since $table will be either data or null
  +          -->
  +             
  +          <xsl:if test="not($table)" >
  +          	<xsl:message>Error in Query</xsl:message>
  +            <xsl:copy-of select="sql:getError($db)/ext-error" />
  +          </xsl:if>
  +          
             <TR>
                <xsl:for-each select="$table/row-set/column-header">
                  <TH><xsl:value-of select="@column-label"/></TH>
  
  
  

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