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:27:43 UTC
cvs commit: xml-xalan/java/samples/extensions/sql/basic-connection dbtest-cinfo.xsl dbtest.xsl
johng 01/08/01 11:27:43
Modified: java/samples/extensions/sql/basic-connection
dbtest-cinfo.xsl dbtest.xsl
Log:
Added the new connect mechinism and error checking
Submitted by: John Gentilin
Revision Changes Path
1.2 +20 -1 xml-xalan/java/samples/extensions/sql/basic-connection/dbtest-cinfo.xsl
Index: dbtest-cinfo.xsl
===================================================================
RCS file: /home/cvs/xml-xalan/java/samples/extensions/sql/basic-connection/dbtest-cinfo.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dbtest-cinfo.xsl 2001/04/19 04:16:12 1.1
+++ dbtest-cinfo.xsl 2001/08/01 18:27:43 1.2
@@ -10,8 +10,15 @@
<xsl:param name="query" select="'SELECT * FROM import1'"/>
<xsl:template match="/">
- <xsl:variable name="db" select="sql:new($cinfo)"/>
+ <xsl:variable name="db" select="sql:new()"/>
+ <!-- Connect to the database with minimal error detection -->
+ <xsl:if test="not(sql:connect($db, $cinfo))" >
+ <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>
@@ -19,6 +26,18 @@
<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>
1.2 +21 -3 xml-xalan/java/samples/extensions/sql/basic-connection/dbtest.xsl
Index: dbtest.xsl
===================================================================
RCS file: /home/cvs/xml-xalan/java/samples/extensions/sql/basic-connection/dbtest.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dbtest.xsl 2001/04/19 04:16:12 1.1
+++ dbtest.xsl 2001/08/01 18:27:43 1.2
@@ -8,11 +8,18 @@
<xsl:param name="driver" select="'org.enhydra.instantdb.jdbc.idbDriver'"/>
<xsl:param name="datasource" select="'jdbc:idb:../../instantdb/sample.prp'"/>
-<xsl:param name="query" select="'SELECT * FROM import1'"/>
+<xsl:param name="query" select="'SELECT * FROM import2'"/>
<xsl:template match="/">
- <xsl:variable name="db" select="sql:new($driver, $datasource)"/>
-
+
+ <xsl:variable name="db" select="sql:new()"/>
+
+ <!-- Connect to the database with minimal error detection -->
+ <xsl:if test="not(sql:connect($db, $driver, $datasource))" >
+ <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>
@@ -20,6 +27,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