DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20843>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20843

When trying to select 3824 rows from a DB i get an ArrayIndexOutOfBoundsException





------- Additional Comments From [EMAIL PROTECTED]  2003-06-27 14:23 -------
Unfortunatly i have moved past this problem and did not take a copy of the 
error prone xsl.


I have tried to recreate the xsl from memory (untested to ensure this has the 
problem).  You will need to create a table with enough rows (over 3000) for the 
query.

I am hopeful that the xsl below may help.

<?xml version="1.0"?>
<!-- edited with XMLSPY v5 rel. 3 U (http://www.xmlspy.com) by Mark Turnbull  --
>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0" 
xmlns:xalan="http://xml.apache.org/xslt"; extension-element-prefixes="sql">
    <!-- ****************************************************************** -->
    <xsl:output omit-xml-declaration="no" method="xml" indent="yes" 
version="1.0" standalone="yes" media-type="xml"/>
    <!-- ****************************************************************** -->
    <xsl:variable name="dbName" select="sql:new()"/>
    <xsl:variable name="dbFirstLetter" select="sql:new()"/>
    <!-- ****************************************************************** -->
    <xsl:template name="OpenDB">
        <xsl:param name="dbName"/>
        <xsl:if test="not(sql:connect($dbName, $cinfo))">
            <xsl:copy-of select="sql:getError($dbName)/ext-error"/>
            <xsl:message terminate="yes">Error Connecting to the 
Database</xsl:message>
        </xsl:if>
        <xsl:value-of select="sql:disableStreamingMode($dbName)"/>
        <xsl:value-of select="sql:clearParameters($dbName)"/>
        <xsl:value-of select="sql:disableDefaultConnectionPool($dbName)"/>
    </xsl:template>
    <xsl:template name="CloseDB">
        <xsl:param name="dbName"/>
        <xsl:value-of select="sql:close($dbName)"/>
    </xsl:template>
    <!-- ****************************************************************** -->
    <!--This query returns all the first letter of all names-->
    <xsl:param name="FirstLetter" select="'select distinct UPPER(substr(NAME, 
1, 1)) AS FIRSTLETTER, count(*) AS COUNT 
FROM sampletable GROUP BY substr(name, 1,1) ORDER BY FIRSTLETTER'"/>
    <!-- ****************************************************************** -->
    <!--This returns all the name that begin with a given letter-->
    <xsl:param name="GetNames" select="'SELECT name FROM sampletable WHERE UPPER
(substr(NAME, 1, 1))  = ?'"/>
    <!-- ****************************************************************** -->
    <xsl:template match="/">
        <Test createdBy="uri:dmu:v2" createdAt="{$curDate}">
            <xsl:call-template name="OpenDB">
                <xsl:with-param name="dbName" select="$dbFirstLetter"/>
            </xsl:call-template>
            <xsl:variable name="FirstLetter" select="sql:query($dbFirstLetter, 
$FirstLetter)"/>
            <xsl:choose>
                <xsl:when test="not($FirstLetter)">
                    <xsl:copy-of select="sql:getError($dbFirstLetter)/ext-
error"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:apply-templates select="$FirstLetter/sql/row-set/row" 
mode="FirstLetter"/>
                </xsl:otherwise>
            </xsl:choose>
            <xsl:call-template name="CloseDB">
                <xsl:with-param name="dbName" select="$dbFirstLetter"/>
            </xsl:call-template>
        </Test>
        <xsl:text>&#10;&#10;</xsl:text>
    </xsl:template>
    <!-- ****************************************************************** -->
    <xsl:template match="row" mode="FirstLetter">
        <xsl:variable name="FirstLetter" select="[EMAIL PROTECTED]
name='FIRSTLETTER']/text()"/>
        <xsl:variable name="Count" select="[EMAIL PROTECTED]'COUNT']/text()"/>
        <xsl:if test="not(sql:connect($dbCsite, $cinfo))">
            <xsl:copy-of select="sql:getError($dbCsite)/ext-error"/>
            <xsl:message terminate="yes">Error Connecting to the 
Database</xsl:message>
        </xsl:if>
        <xsl:call-template name="OpenDB">
            <xsl:with-param name="dbName" select="$dbName"/>
        </xsl:call-template>
        <xsl:value-of select="sql:addParameterWithType($dbName, 
$FirstLetter, 'string')"/>
        <xsl:variable name="Names" select="sql:pquery($dbName, $GetNames)"/>
        <xsl:choose>
            <xsl:when test="not($Names)">
                <xsl:message>Error in Query</xsl:message>
                <xsl:copy-of select="sql:getError($dbName)/ext-error"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:apply-templates select="$Names/sql/row-set/row" 
mode="Name">
                    <xsl:with-param name="FirstLetter" select="$FirstLetter"/>
                </xsl:apply-templates>
            </xsl:otherwise>
        </xsl:choose>
        <xsl:call-template name="CloseDB">
            <xsl:with-param name="dbName" select="$dbName"/>
        </xsl:call-template>
    </xsl:template>
    <!-- ****************************************************************** -->
    <xsl:template match="row" mode="Name">
        <xsl:param name="FirstLetter"/>
        <xsl:variable name="Name" select="[EMAIL PROTECTED]'NAME']/text()"/>
        <Blah FirstLetter="{$FirstLetter}" Name="{$Name}"/>
    </xsl:template>
</xsl:stylesheet>

Reply via email to