Update of /cvsroot/monetdb/pathfinder/compiler/algebra/prop
In directory
sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17783/compiler/algebra/prop
Modified Files:
prop_ocol.c
Log Message:
* Algebra and MIL implementation of the XQuery update functions:
upd:delete
upd:insertAfter
upd:insertBefore
upd:insertIntoAsFirst
upd:insertIntoAsLast
upd:rename
upd:replaceElementContent
upd:replaceNode
upd:replaceValue
There is some things that must be still done in the algebra level, e.g.,
reverse the order of the sequence in the insertBefore/insertIntoASFirst
functions. Also the mil implementation of the serialize operator for
updates is not done yet. So basically updates wont work yet in the
algebra backend, but we are getting closer.
Index: prop_ocol.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/prop/prop_ocol.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- prop_ocol.c 7 Nov 2007 22:00:43 -0000 1.37
+++ prop_ocol.c 20 Nov 2007 16:57:25 -0000 1.38
@@ -447,6 +447,74 @@
res_type = ocol_at (L(n), ix[0]).type;
break;
+
+ case alg_fun_upd_delete:
+ assert(n->sem.fun_1to1.refs.count == 1);
+ /* make sure that the attribute is a node */
+ assert(ocol_at (L(n), ix[0]).type & aat_node);
+
+ /* the result type is aat_update bitwise OR the type of
+ the target node shifted 4 bits to the left */
+ assert((ocol_at (L(n), ix[0]).type << 4) & aat_node1);
+ res_type = aat_update | (ocol_at (L(n), ix[0]).type << 4);
+ break;
+
+ case alg_fun_upd_rename:
+ case alg_fun_upd_insert_into_as_first:
+ case alg_fun_upd_insert_into_as_last:
+ case alg_fun_upd_insert_before:
+ case alg_fun_upd_insert_after:
+ case alg_fun_upd_replace_value_att:
+ case alg_fun_upd_replace_value:
+ case alg_fun_upd_replace_element:
+ case alg_fun_upd_replace_node:
+ assert(n->sem.fun_1to1.refs.count == 2);
+
+ /* make some assertions according to the fun signature */
+ switch (n->sem.fun_1to1.kind) {
+ case alg_fun_upd_rename:
+ assert(ocol_at (L(n), ix[0]).type & aat_node);
+ assert(ocol_at (L(n), ix[1]).type & aat_qname);
+ assert((ocol_at (L(n), ix[0]).type << 4) &
+ aat_node1);
+ break;
+ case alg_fun_upd_insert_into_as_first:
+ case alg_fun_upd_insert_into_as_last:
+ case alg_fun_upd_insert_before:
+ case alg_fun_upd_insert_after:
+ case alg_fun_upd_replace_node:
+ assert(ocol_at (L(n), ix[0]).type & aat_node);
+ assert(ocol_at (L(n), ix[1]).type & aat_node);
+ assert((ocol_at (L(n), ix[0]).type << 4) &
+ aat_node1);
+ break;
+ case alg_fun_upd_replace_value_att:
+ assert(ocol_at (L(n), ix[0]).type & aat_anode);
+ assert(ocol_at (L(n), ix[1]).type & aat_uA);
+ assert((ocol_at (L(n), ix[0]).type << 4) &
+ aat_anode1);
+ break;
+ case alg_fun_upd_replace_value:
+ assert(ocol_at (L(n), ix[0]).type & aat_pnode);
+ assert(ocol_at (L(n), ix[1]).type & aat_uA);
+ assert((ocol_at (L(n), ix[0]).type << 4) &
+ aat_pnode1);
+ break;
+ case alg_fun_upd_replace_element:
+ assert(ocol_at (L(n), ix[0]).type & aat_pnode);
+ assert(ocol_at (L(n), ix[1]).type & aat_str);
+ assert((ocol_at (L(n), ix[0]).type << 4) &
+ aat_pnode1);
+ break;
+ default: assert(!"should never reach here"); break;
+ }
+
+ /* the result type is aat_update bitwise OR the type of
+ the target_node shifted 4 bits to the left bitwise OR
+ the type of the second argument */
+ res_type = aat_update | (ocol_at (L(n), ix[0]).type << 4)
+ | ocol_at (L(n), ix[1]).type;
+ break;
}
ocols (n) = copy_ocols (ocols (L(n)), ocols_count (L(n)) + 1);
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins