xml-xalan-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ar...@EASTPOINT.COM
Subject RE: SQL X-Connection - XNodeSet
Date Mon, 28 Jul 2003 17:29:15 GMT
I bet you thought that I forgot about this... nah... just too busy.
Unfortunately I have not been able to find much. The only e-mail I could
find is the one attached. Does not say much - other than where the change
was. And even that is not particularly helpful. Doing a DIFF I see the
following differences:

CVS:
  public double getNumberFromNode(int n)
  {
    XMLString xstr = m_dtmMgr.getDTM(n).getStringValue(n);
    return xstr.toDouble();
  }

NEW:
  public double getNumberFromNode(int n)
  {
    XMLString xstr = null;
    if ( m_dtmMgr != null )
      xstr = m_dtmMgr.getDTM(n).getStringValue(n);
    else
      xstr = m_iter.getDTMManager().getDTM(n).getStringValue(n);

    return xstr.toDouble();
  }

CVS:
  public XMLString getStringFromNode(int n)
  {
    // %OPT%
    // I guess we'll have to get a static instance of the DTM manager...
    if(DTM.NULL != n)
    {
      return m_dtmMgr.getDTM(n).getStringValue(n);
    }
    else
    {
      return org.apache.xpath.objects.XString.EMPTYSTRING;
    }
  }

NEW:
  public XMLString getStringFromNode(int n)
  {
    // %OPT%
    // I guess we'll have to get a static instance of the DTM manager...
    if(DTM.NULL != n)
    {
      if ( m_dtmMgr != null )
        return m_dtmMgr.getDTM(n).getStringValue(n);
	  else
        return m_iter.getDTMManager().getDTM(n).getStringValue(n);
    }
    else
    {
      return org.apache.xpath.objects.XString.EMPTYSTRING;
    }
  }

CVS:
  public void dispatchCharactersEvents(org.xml.sax.ContentHandler ch)
          throws org.xml.sax.SAXException
  {
    int node = item(0);
	
    if(node != DTM.NULL)
    {

      m_dtmMgr.getDTM(node).dispatchCharactersEvents(node, ch, false);
    }
  }

NEW:
  public void dispatchCharactersEvents(org.xml.sax.ContentHandler ch)
          throws org.xml.sax.SAXException
  {
    int node = item(0);
	
    if(node != DTM.NULL)
    {
      if ( m_dtmMgr != null )
        m_dtmMgr.getDTM(node).dispatchCharactersEvents(node, ch, false);
	  else
        m_iter.getDTMManager().getDTM(node).dispatchCharactersEvents(node,
ch, false);
    } 
  }

CVS:
  public NodeList nodelist() throws javax.xml.transform.TransformerException
  {
    org.apache.xml.dtm.ref.DTMNodeList nodelist = new
org.apache.xml.dtm.ref.DTMNodeList(this);
    // Creating a DTMNodeList has the side-effect that it will create a
clone
    // XNodeSet with cache and run m_iter to the end. You cannot get any
node
    // from m_iter after this call. As a fix, we call SetVector() on the
clone's 
    // cache. See Bugzilla 14406.
    XNodeSet clone = (XNodeSet)nodelist.getDTMIterator();
    SetVector(clone.getVector());
    return nodelist;
  }

NEW:
  public NodeList nodelist() throws javax.xml.transform.TransformerException
  {
    return new org.apache.xml.dtm.ref.DTMNodeList(iter());
/*
    org.apache.xml.dtm.ref.DTMNodeList nodelist = new
org.apache.xml.dtm.ref.DTMNodeList(this);
    // Creating a DTMNodeList has the side-effect that it will create a
clone
    // XNodeSet with cache and run m_iter to the end. You cannot get any
node
    // from m_iter after this call. As a fix, we call SetVector() on the
clone's 
    // cache. See Bugzilla 14406.
    XNodeSet clone = (XNodeSet)nodelist.getDTMIterator();
    SetVector(clone.getVector());
    return nodelist;
*/
  }

Pretty obviously this has to do with the DTM Manager (m_dtmMgr) not being
initialized. I vaguely recall this having something to do with an iterator,
but do not remember any more. At the moment I do not have time to
investigate further. I do know that we are using the modified version of
XNodeSet without problems. I do not remember the situation that would cause
m_dtmMgr not to be set - or why it could not be changed to set it - perhaps
just too many places that would need to be changed.

Sorry I could not be more helpful.

Art


-----Original Message-----
From: John Gentilin [mailto:gentijo@eyecatching.com] 
Sent: Tuesday, July 15, 2003 2:39 PM
To: xalan
Subject: Re: SQL X-Connection


Art,

I don't think this is the rowset problem although I have to admit I have not
looked at the XNodeSet code very closely.

The problem with the rowset code is that the SortedWalker thinks that the
DTM Document is not in Document Order, so it walks the document trying to
put it back in document order.  Once it does this though, the JDBC 
recordset
is exhausted, in streaming mode, and the only row left is the last one. 
Now if you
select back on the rowset, there is only one element so the sorting 
happens but has
no effect. Subsequent templates i.e. "row" don't try to re-order the 
document because
the re-order already occurred. This bug has appeared before and Scot 
Boag has
fixed it but then it comes back. I think we are battling another bug 
that needs
preordered documents. Last I heard there was an effort to support DTM 
pruning
which would operate on preorderd documents.

-JG



I will need to do a little research on this. It was quite a while ago that I
submitted this and I have long since forgotten the details. I just remember
that it had something to do with results coming back (or not) or something
like that. I am also fairly certain that slightly different versions were
needed for Xalan 2.4 and 2.5. I thought that I had described the details at
the time in an e-mail. I will see if I can find that somewhere. Maybe I will
also do some DIFFs to figure out what I changed. Unfortunately, unless I was
particularly diligent in an e-mail that I can find (or it is obvious from
the code change) the rational may be lost.

It could be that this fixes the rowset problem described earlier... at least
the version of Xalan that I am running does not exhibit that problem - but
that could be because all my XConnections have multiple-results enabled. At
least I think so, personally I have not used the Xalan SQL extension in a
long time, other members of my team have been doing all of that.

I will try to get to this in the next few days... maybe tonight if I finish
the stuff I am working on early - or if curiosity gets the better of me...

Art




Mime
View raw message