[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

XQJ (JSR 225)

Michael Kay mike at saxonica.com
Thu Jun 25 14:46:39 PDT 2009


  XQJ (JSR 225)
>   BTW, does someone knows why there is a difference between 
> an "expression" object that is actually used to evaluate 
> (possibly several different if I am right) XQuery expressions 
> and a "prepared expression" that really represents a 
> (compiled) XQuery expression?
> 
>   At first glance, it seems rather confusing to me.


It's a very strange design. It's worth noting that neither XQExpression nor
XQPreparedExpression is thread-safe - both extend XQDynamicContext and
therefore hold context information which is different for each evaluation of
the expression.

The difference between them is that XQPreparedExpression contains a compiled
expression or query, whereas XQExpression merely holds the dynamic context
for executing an expression or query - despite its name, the expression to
be evaluated is not held in the XQExpression object, but is always supplied
dynamically. 

Whenever I complained about the design (or even the nomenclature) I was told
it would all seem completely intuitive to people who know JDBC. I've no idea
whether that's true; I'm quite sure it's not a good justification.

Unless you need the portability, I recommend Saxon's s9api interface. It's
also probably more efficient. A weird consequence of the close() mechanism
in XQJ, which was presumably designed to allow resources to be released
early, is that Saxon has to maintain links between a connection and all the
objects created under that connection, and this stops those resources being
garbage collected.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.