W3C home > Mailing lists > Public > public-qt-comments@w3.org > April 2007

[Bug 4441] [XQuery] 2.3.4 Optimization rules unclear?

From: <bugzilla@wiggum.w3.org>
Date: Tue, 03 Apr 2007 16:37:07 +0000
CC:
To: public-qt-comments@w3.org
Message-Id: <E1HYm0J-0007jR-5d@wiggum.w3.org>

http://www.w3.org/Bugs/Public/show_bug.cgi?id=4441





------- Comment #9 from martin@x-hive.com  2007-04-03 16:37 -------
I don't think it's necessary to write horrible code to trick an XQuery
interpreter into executing statements in order. You can simply make them depend
on each other via input and output data, and processors will be forced to
execute them in order.

let $jdbc:connection := jdbc:get-connection('jdbc://some/url')
let $jdbc:result := jdbc:execute-sql($jdbc:connection, 'SELECT * FROM foo')
let $jdbc:connection := $jdbc:result/connection
 ... do something with the result ...
let $jdbc:close-token := jdbc:close($jdbc:connection)
return $jdbc:close-token

The $jdbc:* stuff doesn't actually need to really _be_ the connection or
anything, it's sufficient if it's some sort of token, even a string simply
containing 'hello world' will do.

I've seen people doing these side-effect calls several times, and I really
think it's not a good idea. It might be a bit ugly to return stuff like
$jdbc:close-token from the query, be it empty or an XML comment or anything,
but it sure is better than having ugly side effects happening behind the back
of your query processor. Especially with all the problems that ensue from that.
Received on Tuesday, 3 April 2007 16:37:20 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:33 UTC