Andreas,
If I do that I get the following message:
"Could not execute OPEN invoiceDB: java.lang.IndexOutOfBoundsException"
And if I run the perl script again I get this:
"Not expected (Data Access out of bounds [pre:17508, indexSize:70, access:70> 69]). at /var/www/serprest/perl/3rd-party/BaseXClient.pm line 195"
I really don't know how to workaround this.
Thanks
Isidro
Em 30-03-2011 18:17, Andreas Weiler escreveu:
Hi Isidro,
you have to reopen the database in the GUI.
-- Andreas
Am 30.03.2011 um 18:11 schrieb Isidro Vila Verde:
Hi again,
This is my (original) problem.
If I try to run a xquery update from GUI and then try to get the modified XML element everything is ok.
But if a run the same xquery from a perl script and then go to the GUI, to get the modified XML element I get this error:
------------------------------Error obtained, in GUI, after run the update query from a perl script--------------------------- Query: import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml";
m:getInvoiceSumary(xs:string('279'))
Error: Possible bug? Your feedback is welcome: Contact: basex-talk@mailman.uni-konstanz.de Version: BaseX 6.6 Java: Sun Microsystems Inc., 1.6.0_20 OS: Linux, amd64 Stack Trace: java.lang.IndexOutOfBoundsException java.io.RandomAccessFile.readBytes(Native Method) java.io.RandomAccessFile.read(RandomAccessFile.java:355) java.io.RandomAccessFile.readFully(RandomAccessFile.java:414) org.basex.io.DataAccess.cursor(DataAccess.java:225) org.basex.io.DataAccess.readToken(DataAccess.java:147) org.basex.data.DiskData.txt(DiskData.java:213) org.basex.data.DiskData.text(DiskData.java:181) org.basex.data.Data.atom(Data.java:241) org.basex.query.item.DBNode.atom(DBNode.java:84) org.basex.query.item.Str.eq(Str.java:77) org.basex.query.item.ANode.eq(ANode.java:73) org.basex.query.expr.CmpV$Op$5.e(CmpV.java:80) org.basex.query.expr.CmpG.eval(CmpG.java:232) org.basex.query.expr.CmpG.item(CmpG.java:181) org.basex.query.expr.CmpG.item(CmpG.java:1) org.basex.query.expr.ParseExpr.ebv(ParseExpr.java:85) org.basex.query.expr.ParseExpr.test(ParseExpr.java:98) org.basex.query.expr.Preds.preds(Preds.java:99) org.basex.query.path.IterStep$1.next(IterStep.java:49) org.basex.query.path.AxisPath.iter(AxisPath.java:438) org.basex.query.path.AxisPath.iter(AxisPath.java:408) org.basex.query.QueryContext.iter(QueryContext.java:330) org.basex.query.expr.ParseExpr.value(ParseExpr.java:76) org.basex.query.expr.Let$1.next(Let.java:94) org.basex.query.expr.FLWR$1.next(FLWR.java:62) org.basex.query.iter.Iter.finish(Iter.java:65) org.basex.query.expr.ParseExpr.value(ParseExpr.java:76) org.basex.query.expr.Func.iter(Func.java:99) org.basex.query.QueryContext.iter(QueryContext.java:330) org.basex.query.expr.FuncCall.iter(FuncCall.java:80) org.basex.query.QueryContext.iter(QueryContext.java:330) org.basex.query.QueryContext.iter(QueryContext.java:295) org.basex.query.QueryContext.eval(QueryContext.java:253) org.basex.query.QueryProcessor.execute(QueryProcessor.java:113) org.basex.core.cmd.AQuery.query(AQuery.java:83) org.basex.core.cmd.XQuery.run(XQuery.java:22) org.basex.core.Command.run(Command.java:292) org.basex.core.Command.exec(Command.java:274) org.basex.core.Command.execute(Command.java:67) org.basex.gui.GUI.exec(GUI.java:390) org.basex.gui.GUI$5.run(GUI.java:351)
------------This is the query which throws the above error message ------------------------- import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml";
m:getInvoiceSumary(xs:string('279'))
-------------This is the update query, as invoked from GUI------------------------ import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml";
m:invoiceUpdate(<saf:Invoice xmlns:spi="http://serprest.pt/invoice1" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01">
saf:InvoiceNo279</saf:InvoiceNo> saf:InvoiceDate2011-01-27</saf:InvoiceDate> saf:InvoiceTypeFactura</saf:InvoiceType>
<!--saf:SystemEntryDate>2011-01-27T20:31:32.212Z</saf:SystemEntryDate-->
saf:CustomerID555561</saf:CustomerID> spi:PayDateExpected2011-02-27</spi:PayDateExpected> spi:PayDate</spi:PayDate> spi:ReceiptID</spi:ReceiptID> spi:StatusIniciada</spi:Status> </saf:Invoice>)
-------------This is the PERL script with the same update query. Run this script is the the source of problem------------------------ #!/usr/bin/perl use strict; use lib qw|/var/www/serprest/perl/3rd-party|; use BaseXClient; use warnings;
eval { my $session = Session->new("localhost", 1984, "serprest", ".prest,ser");
my $q = q| import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml"; m:invoiceUpdate(<saf:Invoice xmlns:spi="http://serprest.pt/invoice1" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01">
saf:InvoiceNo279</saf:InvoiceNo> saf:InvoiceDate2011-01-27</saf:InvoiceDate> saf:InvoiceTypeFactura</saf:InvoiceType>
<!--saf:SystemEntryDate>2011-01-27T20:31:32.212Z</saf:SystemEntryDate-->
saf:CustomerID555561</saf:CustomerID> spi:PayDateExpected2011-02-27</spi:PayDateExpected> spi:PayDate</spi:PayDate> spi:ReceiptID</spi:ReceiptID> spi:StatusIniciada</spi:Status> </saf:Invoice>)
|; my $query = $session->query($q); $query->init(); print $query->execute(); print $query->info(); $query->close(); $session->close();
};
# print exception print qq|<error>$@</error>| if $@;
-----------------This is module which implement the two functions used in the above queries------------------- module namespace x = "http://serprest.pt/invoice/xqm"; declare namespace saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"; declare namespace spi="http://serprest.pt/invoice1"; declare namespace fx="http://www.basex.org/file"; declare variable $x:col := collection('invoiceDB');
[... some stuff deleted here ...] declare function x:getInvoiceSumary($invoiceNo as xs:string) as node()? { let $invoice := $x:col/saf:Invoice[saf:InvoiceNo/text()=$invoiceNo] return if ($invoice/saf:Line) then copy $c := $invoice modify delete node $c/saf:Line return $c else $invoice }; [... some stuff deleted here ...] declare updating function x:invoiceUpdate($newInvoice as node()){ let $invoice := $x:col/saf:Invoice[saf:InvoiceNo/text() = $newInvoice/saf:InvoiceNo/text()] for $p in $newInvoice/* let $target := $invoice/*[name() = name($p)][last()] return if ($target) then replace node $target with $p else insert node $p as last into $invoice };
-------------This is the log----------------------- 08:34:22.513 [127.0.0.1:48542] QUERY(0) import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml"; m:invoiceUpdate(<saf:Invoice xmlns:spi="http://serprest.pt/invoice1" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"> saf:InvoiceNo279</saf:InvoiceNo> saf:InvoiceDate2011-01-27</saf:InvoiceDate> saf:InvoiceTypeFactura</saf:InvoiceType> <!--saf:SystemEntryDate>2011-01-27T20:31:32.212Z</saf:SystemEntryDate--> saf:CustomerID555561</saf:CustomerID> spi:PayDateExpected2011-02-27</spi:PayDateExpected> spi:PayDate</spi:PayDate> spi:ReceiptID</spi:ReceiptID> spi:StatusIniciada</spi:Status> </saf:Invoice>) OK 08:34:22.523 [127.0.0.1:48542] QUERY(0) OK 08:34:22.611 [127.0.0.1:48542] INIT(0) OK 08:34:22.612 [127.0.0.1:48542] EXEC(0) OK 08:34:22.613 [127.0.0.1:48542] INFO(0) OK 08:34:22.613 [127.0.0.1:48542] CLOSE(0) OK 08:34:22.615 [127.0.0.1:48542] LOGOUT serprest OK
If I run the m:getInvoiceSumary(xs:string('279')) again it runs without any error message but it returns a empty result. If I close and open the GUI again the result still be a empty result and if I try to open the DB I get a popup message saying: "Could not execute OPEN invoiceDB: java.lang.IndexOutOfBoundsException"
Any help/glue is welcome.
Thanks
Isidro
avast! Antivirus: Outbound message clean. Virus Database (VPS): 110330-0, 30-03-2011 Tested on: 30-03-2011 17:11:11 avast! - copyright (c) 1988-2011 AVAST Software. http://www.avast.com
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
avast! Antivirus: Inbound message clean. Virus Database (VPS): 110330-0, 30-03-2011 Tested on: 30-03-2011 18:17:54 avast! - copyright (c) 1988-2011 AVAST Software. http://www.avast.com
--- avast! Antivirus: Outbound message clean. Virus Database (VPS): 110330-0, 30-03-2011 Tested on: 30-03-2011 18:28:25 avast! - copyright (c) 1988-2011 AVAST Software. http://www.avast.com