{
try
{
// If we have not started the RowSet yet, then add it to the
// tree.
System.out.println("cSQLDocument.addRowToDTMFromResultSet() m_FirstRowIdx=" + m_FirstRowIdx);
if (m_FirstRowIdx == DTM.NULL)
{
m_RowSetIdx = addElement(1, m_RowSet_TypeID, m_SQLIdx, m_RowSetIdx);
extractSQLMetaData(m_ResultSet.getMetaData());
}
// Check to see if all the data has been read from the Query.
// If we are at the end the signal that event
if ( ! m_ResultSet.next())
{
// In Streaming mode, the current ROW will always point back
// to itself until all the data was read. Once the Query is
// empty then point the next row to DTM.NULL so that the stream
// ends. Only do this if we have statted the loop to begin with.
{
// We are at the end, so let's untie the mark
m_nextsib.setElementAt(DTM.NULL, m_LastRowIdx);
}
while ( !m_Statement.getMoreResults() && m_Statement.getUpdateCount() >= 0 ) ;
m_ResultSet = m_Statement.getResultSet();
{
m_FirstRowIdx = DTM.NULL;
addRowToDTMFromResultSet();
}
else
{
// Get output parameters.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:sql="com.eastpoint.chrysalis.SQLDocumentHandler"
extension-element-prefixes="sql">
<xsl:output method="html" indent="yes"/>
<xsl:param name="query" select="'SELECT * FROM bkparama WHERE groupid = 25'"/>
<xsl:template match="/">
<!-- 1. Make the connection -->
<xsl:variable name="products"
select="sql:new('com.sybase.jdbc2.jdbc.SybDriver',
'jdbc:sybase:Tds:dev1:1234/teller', 'teller', 'password')"/>
<xsl:variable name="groupid" select="25"/>
<xsl:variable name="l_result" select="0"/>
<xsl:variable name="l_server" select="''"/>
<xsl:variable name="table" select="sql:query($products, '?[integer=l_result] = CALL testproc ?[integer=groupid], ?[varchar=l_server OUT]')"/>
l_result=<xsl:value-of select="$l_result"/>
l_server=<xsl:value-of select="$l_server"/>
<xsl:value-of select="sql:close($products)"/>
</xsl:template>
-----Original Message-----Art,
From: John Gentilin [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 15, 2002 6:59 PM
To: [EMAIL PROTECTED]
Cc: Scott Boag; Art Welch
Subject: Re: SQL Extension enhancement/replacementSounds great. My main concern is that you change to the return data will break
most implementations in use today, the same goes with query and pquery although
adding a cquery would work just fine. One advantage of query is that it uses a
Statement instead of a Prepared Statement. In MSSQL and other DB's there is
a hugh performance hit with a Prepared Statement.Since an SQLDocument really represents an SQL ResultSet why don't you allow
the XConnection to return multiple SQLDocuments that way query/pquery/cquery
will return the first Result Set then may add a function, getNextResultSet to grab the
others. That way you support multiple Result Sets without breaking previous
implementations, also I think it will be less complicated with streaming mode.
How do you transition from one result set to another in streaming mode ?I am confused about the use of I/O parameters since most of the SQL Extension
parameters can be passed either XSL variables or elements and allow any return
type unless you are modifying parameters that are passed in which probably
violates the XSLT spec.I personally would not vote in favor of changing the SQL Document return format
(in a way that breaks previous code) since it would affect 100's of my existing SS's.Why don't you post the some example XSL code to the list so we can review it
and decide on how to integrate the new code. Have you tested both Streaming and
Non Streaming mode with the new code ??If you send me a zip file of the code, I will review the implementation.
Regards
John G
[EMAIL PROTECTED] wrote:
I have been working on an enhanced SQL extension for Xalan-J. This adds support for callable statements, multiple result sets, and output parameters. To do this it makes some changes from the syntax of the existing SQL extension. Most significantly to support multiple result sets, the metadata element is made a child of the row-set element. There are also changes to the call syntax. Parameters (input and output) are passed via variables.
I would like to contribute this enhanced SQL to the Xalan project. Is there interest in this contribution? Since this changes the sql extension syntax, should I package this as an alternative function, cquery() for example, or just replace query() and pquery() with a new query()? Note that the new function and be used to do everything that query() and pquery() currently do (with different syntax) as well as the new functionality. In short, if the query has parameter definitions then they are used, if it starts with "CALL" (perhaps after a return parameter definition) then it is assumed to be a CallableStatement.
The current status of this is that it has had only limited testing - but seems to be working. There are some details that need to be cleaned up, some debugging stuff to be deleted, etc. This could be submitted fairly soon (unless further testing uncovers something).
Thank You,
Art--
--------------------------------------
John Gentilin
Eye Catching Solutions Inc.
18314 Carlwyn Drive
Castro Valley CA 94546Contact Info
[EMAIL PROTECTED]
Ca Office 1-510-881-4821
NJ Office 1-732-422-4917
