|
[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.comThu Jun 25 14:46:39 PDT 2009
> 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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






