Re: [saxon] XQJ : problem with 'getInt', 'getShort'

On 26/08/2010 8:14 PM, Hans-Juergen Rennau wrote:
> try {
> XQDataSource ds = new SaxonXQDataSource();
> XQConnection co = ds.getConnection();
> String query = "for $i in 120 to 130 return xs:int($i)";
> XQPreparedExpression ex = co.prepareExpression(query);
> XQSequence result = ex.executeQuery();
> while (result.next())
> System.out.println(result.getInt());
> } catch (Exception e) {
> e.printStackTrace();
> }
Hans-Juergen,
Thanks for your continued efforts to weed the bugs out of the XQJ
interface. I've logged this bug, committed the patch for both the 9.1
and 9.2 branches, and added the test cases to my JUnit tests.
(I was struck when stepping through this test case how much of the time
Saxon is spending simply checking that none of the containing XQJ
objects have been closed, a check that's only necessary because XQJ
insists that an error must be thrown in this case. There must be a
better way of doing this, for example a notification mechanism where the
Connection holds weak references to everything created using that
Connection. But it's ludicrously complicated and unnecessary. Saxon's
also doing a lot of work to enforce the quite unnecessary restriction
that in a forwards sequence, items can only be read once.)
Regards,
Michael Kay
Saxonica

On 26/08/2010 8:14 PM, Hans-Juergen Rennau wrote:
> try {
> XQDataSource ds = new SaxonXQDataSource();
> XQConnection co = ds.getConnection();
> String query = "for $i in 120 to 130 return xs:int($i)";
> XQPreparedExpression ex = co.prepareExpression(query);
> XQSequence result = ex.executeQuery();
> while (result.next())
> System.out.println(result.getInt());
> } catch (Exception e) {
> e.printStackTrace();
> }
Hans-Juergen,
Thanks for your continued efforts to weed the bugs out of the XQJ
interface. I've logged this bug, committed the patch for both the 9.1
and 9.2 branches, and added the test cases to my JUnit tests.
(I was struck when stepping through this test case how much of the time
Saxon is spending simply checking that none of the containing XQJ
objects have been closed, a check that's only necessary because XQJ
insists that an error must be thrown in this case. There must be a
better way of doing this, for example a notification mechanism where the
Connection holds weak references to everything created using that
Connection. But it's ludicrously complicated and unnecessary. Saxon's
also doing a lot of work to enforce the quite unnecessary restriction
that in a forwards sequence, items can only be read once.)
Regards,
Michael Kay
Saxonica