haul 2002/09/06 02:59:31 Modified: src/java/org/apache/cocoon/components/language/markup/xsp/java Tag: cocoon_2_0_3_branch esql.xsl Log: Patch thanks to neil <[EMAIL PROTECTED]> - removes reflexion in favour of verbatim copy - adds paging for results obtained from column Revision Changes Path No revision No revision 1.13.2.9 +21 -4 xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java/esql.xsl Index: esql.xsl =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java/esql.xsl,v retrieving revision 1.13.2.8 retrieving revision 1.13.2.9 diff -u -r1.13.2.8 -r1.13.2.9 --- esql.xsl 11 Aug 2002 20:08:57 -0000 1.13.2.8 +++ esql.xsl 6 Sep 2002 09:59:31 -0000 1.13.2.9 @@ -978,13 +978,28 @@ <xspdoc:desc>creates a nested query like block that uses the result set obtained from a column as current result set.</xspdoc:desc> <xsl:template name="use-results" match="esql:use-results[child::esql:result]"> + <xsl:variable name="maxrows"><xsl:call-template name="get-nested-string"><xsl:with-param name="content" select="esql:max-rows"/></xsl:call-template></xsl:variable> + <xsl:variable name="skiprows"><xsl:call-template name="get-nested-string"><xsl:with-param name="content" select="esql:skip-rows"/></xsl:call-template></xsl:variable> <xsp:logic> // nested result set if (_esql_query != null) { _esql_queries.push(_esql_query); } _esql_query = new EsqlQuery((ResultSet) <xsl:apply-templates select="esql:result/*"/>); - { + + <xsl:if test="esql:max-rows"> + try { + _esql_query.setMaxRows( Integer.parseInt(String.valueOf(<xsl:copy-of select="$maxrows"/>).trim()) ); + } catch (NumberFormatException e) {} + </xsl:if> + + <xsl:if test="esql:skip-rows"> + try { + _esql_query.setSkipRows( Integer.parseInt(String.valueOf(<xsl:copy-of select="$skiprows"/>).trim()) ); + } catch (NumberFormatException e) {} + </xsl:if> + + { <xsl:call-template name="do-results"/> } if (_esql_queries.empty()) { @@ -1098,7 +1113,9 @@ <xsl:when test="$type='AsciiStream'">Types.LONGVARCHAR</xsl:when> <xsl:when test="$type='UnicodeStream'">Types.LONGVARCHAR</xsl:when> <xsl:when test="$type='BinaryStream'">Types.VARBINARY</xsl:when> - <xsl:when test="contains($type,'.')">EsqlQuery.getType("<xsl:value-of select="$type"/>")</xsl:when> + <!-- handle DBMS specific types e.g. oracle.jdbc.driver.OracleTypes.CURSOR --> + <xsl:when test="contains($type,'.')"><xsl:value-of select="$type"/></xsl:when> + <!-- default to upper case type --> <xsl:otherwise>Types.<xsl:value-of select="translate(@type,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/></xsl:otherwise> </xsl:choose> </xsl:template>
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]