On 23 August 2012 03:53, Christian Grün <
christian.gruen@gmail.com> wrote:
> Hi Arjan,
>
> thanks for your report. I managed to reproduce the issue. I assume
> that this behavior is due to XQJ, which is why I’m forwarding your
> mail to Charles.
>
> Hope this helps,
> Christian
>
> @Charles: if you have more questions, or if you believe that the bug
> is on our side.. Your feedback is welcome!
> ___________________________
>
> On Wed, Aug 22, 2012 at 5:44 PM, Arjan van Bentem
> <
arjan.vanbentem@bidnetwork.org> wrote:
>> Hi all,
>>
>> Maybe this is related to
http://xqj.net/basex/ instead of BaseX itself, but
>> as I don't know allow me to ask here first.
>>
>> Whenever I have somehow locked a BaseX database, like by using the
>> standalone command line utility or the GUI, then I get something like the
>> following in the BaseX log files:
>>
>> QUERY(1) for $c in collection('factbook')//country[name='Albania']return(
>> replace value of node $c/@population with xs:integer($c/@population + 1)) OK
>> 39.92 ms
>> QUERY(1) OK 0.62 ms
>> FULL(1) Error: [BXDB0007] Database 'factbook' is opened by another process.
>> CLOSE(1) OK 39.68 ms
>>
>> Good.
>>
>> However, I don't see that error in my Java code. The Java code just
>> continues like all was fine.
>>
>> Can I somehow make the Java code fail when this happens?
>>
>> See example below, and the same thing in the attachment.
>>
>> Thanks,
>> Arjan.
>>
>>
>>
>> private static final String DRIVER = "net.xqj.basex.BaseXXQDataSource";
>>
>> private static final String SELECT =
>> "xs:long(collection('factbook')//country[name='Albania']/@population[1]/data(.))";
>>
>> private static final String UPDATE = "for $c in
>> collection('factbook')//country[name='Albania']"
>> + "return("
>> + " replace value of node $c/@population with xs:integer($c/@population +
>> 1)"
>> + ")";
>>
>> @Test
>> public void testUpdate() {
>> try {
>>
>> XQDataSource xqd = (XQDataSource) Class.forName(DRIVER)
>> .newInstance();
>> XQConnection xqc = xqd.getConnection("admin", "admin");
>> XQExpression xqe = xqc.createExpression();
>>
>> XQSequence xqs = xqe.executeQuery(SELECT);
>> xqs.next();
>> long before = xqs.getLong();
>> System.out.println("Initial value: " + before);
>>
>> System.out.println("Updating...");
>> xqs = xqe.executeQuery(UPDATE);
>>
>> xqs = xqe.executeQuery(SELECT);
>> xqs.next();
>> long after = xqs.getLong();
>> System.out.println("Resulting value: " + after);
>>
>> xqc.close();
>>
>> Assert.assertEquals("Update should have succeeded or failed",
>> before + 1, after);
>>
>> } catch (Exception e) {
>> e.printStackTrace();
>> }
>>
>> }
>>
>>
>> _______________________________________________
>> BaseX-Talk mailing list
>>
BaseX-Talk@mailman.uni-konstanz.de
>>
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
>>
>