[ http://issues.apache.org/jira/browse/XALANJ-1781?page=all ]

Brian Minchau updated XALANJ-1781:
----------------------------------

    Version: Latest Development Code
                 (was: 2.0.0)

> SQL Extension - ResultSet is not returning iteration of values
> --------------------------------------------------------------
>
>          Key: XALANJ-1781
>          URL: http://issues.apache.org/jira/browse/XALANJ-1781
>      Project: XalanJ2
>         Type: Bug
>   Components: Xalan-extensions
>     Versions: Latest Development Code
>  Environment: Operating System: Windows NT/2K
> Platform: PC
>     Reporter: Juraj Lenharcik
>     Assignee: Xalan Developers Mailing List

>
> Running a SQL-statement via the SQL-extension is not returning all values of 
> the table. For example the table looks like this:
> 1 | test1
> 2 | test2
> 3 | test3
> Is returning the following output from the XSL:
> file:/C:/temp/XSLSQL/bin/dbtest.xsl; Zeilennummer148; Spaltennummer15; 3
> file:/C:/temp/XSLSQL/bin/dbtest.xsl; Zeilennummer148; Spaltennummer15; test3
> file:/C:/temp/XSLSQL/bin/dbtest.xsl; Zeilennummer148; Spaltennummer15; 3
> file:/C:/temp/XSLSQL/bin/dbtest.xsl; Zeilennummer148; Spaltennummer15; test3
> file:/C:/temp/XSLSQL/bin/dbtest.xsl; Zeilennummer148; Spaltennummer15; 3
> file:/C:/temp/XSLSQL/bin/dbtest.xsl; Zeilennummer148; Spaltennummer15; test3
> If you create a variable with the same structure you get with the same XSL:
> file:/C:/temp/XSLSQL/bin/dbtest.xsl; Zeilennummer148; Spaltennummer15; 1
> file:/C:/temp/XSLSQL/bin/dbtest.xsl; Zeilennummer148; Spaltennummer15; test1
> file:/C:/temp/XSLSQL/bin/dbtest.xsl; Zeilennummer148; Spaltennummer15; 2
> file:/C:/temp/XSLSQL/bin/dbtest.xsl; Zeilennummer148; Spaltennummer15; test2
> file:/C:/temp/XSLSQL/bin/dbtest.xsl; Zeilennummer148; Spaltennummer15; 3
> file:/C:/temp/XSLSQL/bin/dbtest.xsl; Zeilennummer148; Spaltennummer15; test3
> Here is the XSL code:
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>                 version="1.0"
>                 xmlns:sql="org.apache.xalan.lib.sql.XConnection"
>                 extension-element-prefixes="sql"
>                 
>                 xmlns:xalan="http://xml.apache.org/xalan";
>                    
>                 exclude-result-prefixes="xalan"                
>                 
>                 >
> <xsl:output method="html" indent="yes"/>
> <!-- parameter setting to connect to DB2
> <xsl:param name="driver" select="'COM.ibm.db2.jdbc.app.DB2Driver'"/>
> <xsl:param name="datasource" select="'jdbc:db2:sample'"/>
> -->
> <!-- parameter setting to connect to MySQL -->
> <xsl:param name="driver" select="'com.mysql.jdbc.Driver'"/>
> <xsl:param name="datasource" select="'jdbc:mySQL://localhost/test'"/>
> <xsl:param name="query" select="'SELECT * FROM testtabelle'"/>
> <xsl:param name="username" select="'root'"/>
> <xsl:param name="passwd" select="''"/>
> <xsl:variable name="testt">
>       <row-set>
>               <row>
>                       <col>1</col>
>                       <col>test1</col>
>               </row>
>               <row>
>                       <col>2</col>
>                       <col>test2</col>
>               </row>
>               <row>
>                       <col>3</col>
>                       <col>test3</col>
>               </row>
>       </row-set>      
> </xsl:variable>
> <xsl:template match="/">
>     
>     <xsl:variable name="db" select="sql:new()"/>
>     
>     <!-- Connect to the database with minimal error detection -->
>               <xsl:if test="not(sql:connect($db, $driver, $datasource, 
> $username, $passwd))" >
>       <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>
>       </HEAD>
>       <BODY>
>         <TABLE border="1">
>           <xsl:variable name="table" select='sql:query($db, $query)'/>
>           <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/sql/metadata/column-header">
>                <xsl:message><xsl:value-of 
> select="@column-label"/></xsl:message>
>              </xsl:for-each>
>           </TR>
>           <xsl:apply-templates select="$table/sql/row-set"/> 
>                 <xsl:variable name="testtabelle2" select="xalan:nodeset
> ($testt)"/>
> <!--          <xsl:apply-templates select="$testtabelle2/row-set"/>-->
>         </TABLE>
>       </BODY>
>     </HTML>
>     <xsl:value-of select="sql:close($db)"/>
> </xsl:template>
> <xsl:template match="row-set">
>   <xsl:for-each select="./row">
>       <xsl:apply-templates select="."/>
>   </xsl:for-each>             
> </xsl:template>
> <xsl:template match="row">
>   <xsl:apply-templates select="./col"/>
> </xsl:template>
> <xsl:template match="col">
>       <xsl:message><xsl:value-of select="./text()"/></xsl:message>
> </xsl:template>
> </xsl:stylesheet>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to