Review: Needs Fixing

It seems that automatic indexes are not maintained if a node is deleted. The 
following example shows this:

library module:

module namespace seq = "http://www.foo.com/default";;
                                                                                
                      
import module namespace ddl = 
"http://www.zorba-xquery.com/modules/store/static/collections/ddl";;     
import module namespace dml = 
"http://www.zorba-xquery.com/modules/store/static/collections/dml";;     
import module namespace iddl = 
"http://www.zorba-xquery.com/modules/store/static/indexes/ddl";;        
import module namespace idml = 
"http://www.zorba-xquery.com/modules/store/static/indexes/dml";;        

declare namespace an = "http://www.zorba-xquery.com/annotations";;               
                      

declare collection seq:counters as node()*;                                     
                      

declare %an:automatic %an:unique %an:value-equality index seq:counters-by-uri   
                      
  on nodes dml:collection(xs:QName("seq:counters"))                             
                     
  by xs:string(@uri) as xs:string;

declare %an:sequential function seq:init()
{
 ddl:create(xs:QName("seq:counters"));
 iddl:create(xs:QName("seq:counters-by-uri"));
 dml:insert-nodes(xs:QName("seq:counters"), <foo uri="1"/>);
};

declare function seq:index ()
{
  idml:probe-index-point-value(xs:QName("seq:counters-by-uri"), "1")
};

declare %an:sequential function seq:reset ()
{
  
dml:delete-nodes(idml:probe-index-point-value(xs:QName("seq:counters-by-uri"), 
"1"));
};

main module:

import module namespace seq = "http://www.foo.com/default"; at "default.xq";

seq:init();

variable $foo := seq:index();

seq:reset();

variable $bar := seq:index();

$foo, $bar

The expected result is '<foo uri="1"/><foo uri="1"/>' but should be '<foo 
uri="1"/>'.
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-966706/+merge/101498
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to