db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@apache.org>
Subject XML in Derby - WAS : [jira] Updated: (DERBY-688) Enhancements to XML functionality to move toward XPath/XQuery support...
Date Tue, 29 Aug 2006 16:02:07 GMT
David Van Couvering wrote:

> Wow, great work Army, and thanks for the careful review and effort by
> Brian and Yip!  It's great to have this in.  If I could only grok
> exactly what the feature is and how I might use it :)  I am telling
> people "we have XML features" and I know it's something to do with
> XQuery and XPath, but I couldn't say what.

I was messing with the XML support last night for buddy testing and it's
very cool. Three new Derby features combined together to make the
application development easier:

1) XML support
2) CALL procedure in trigger
3) Lengthless overrides for PreparedStatement.setCharacterStream

OK - I didn't test 3) cos I would have to set up Xalan for Mustang and I
didn't want to spend time on how to figure that out, but it would have
been useful.

I setup a table with a column that contained a URL as a VARCHAR and an
XML column, a procedure in an INSERT trigger then fetched the data from
the URL and updated the XML column using XMLPARSE, streaming directly
from the remote site using setCharacterStream.

I used this to download DERBY Jira issues, each row holds an XML
document that corresponds to a single Jira issue. E.g. from


Then I can execute queries against the issues locally, using XPath (and

-- Sequence of all comments made by Sunitha against bugs reported by me
--  wd_id is the DERBY-XXX identifier
--  wd_accesstime is the time the data was downloaded from the web.
--  wd_content is the XML column

select wd_id, wd_accesstime,
XMLQUERY('//item/comments/comment[@author="skambha"]' PASSING BY REF
wd_content EMPTY ON EMPTY)
AS VARCHAR(30000))
from wdd.web_docs where
XMLEXISTS('//reporter[text() = "Daniel John Debrunner"]' PASSING BY REF

-- Jira status of all bugs entered by me

select wd_id,
XMLQUERY('//item/status/text()' PASSING BY REF wd_content EMPTY ON EMPTY)
from wdd.web_docs where
XMLEXISTS('//reporter[text() = "Daniel John Debrunner"]' PASSING BY REF
order by 2,1;

I'll think I wil expand this to use it in my talk at ApacheCon US.

View raw message