Update of /cvsroot/monetdb/pathfinder/runtime
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv4698/runtime

Modified Files:
        Makefile.ag pathfinder.mx 
Log Message:
propagated changes of Saturday Feb 10 2007 - Sunday Feb 11 2007
from the XQuery_0-16 branch to the development trunk



Index: Makefile.ag
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/Makefile.ag,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- Makefile.ag 25 Jan 2007 00:50:25 -0000      1.67
+++ Makefile.ag 11 Feb 2007 22:04:39 -0000      1.68
@@ -23,6 +23,8 @@
 # Universitaet Muenchen, respectively.  All Rights Reserved.
 #
 
+SUBDIRS = xrpc
+
 EXTRA_DIST_DIR = Tests
 
 INCLUDES = $(MONETDB_INCS) $(MONETDB4_INCS) $(LIBXML2_CFLAGS) 
../compiler/include

Index: pathfinder.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/pathfinder.mx,v
retrieving revision 1.294
retrieving revision 1.295
diff -u -d -r1.294 -r1.295
--- pathfinder.mx       9 Feb 2007 23:41:12 -0000       1.294
+++ pathfinder.mx       11 Feb 2007 22:04:39 -0000      1.295
@@ -2655,37 +2655,102 @@
     return ws_opendoc(ws, idx_names.tmark([EMAIL PROTECTED]), idx_colname, 
idx_coll, idx_doc, false); 
 }
 
+# create a sequence of elements with 2 attributes, out of a four-column table
+PROC xmltab2(BAT[void,bat] ws, BAT[any,any] b) : BAT[void,oid]
+{
+  var eltqn := add_qname ("", "", "bun", ws);
+  var at1qn := add_qname ("", "", "head", ws);
+  var at2qn := add_qname ("", "", "tail", ws);
+  var attr1 := [str](b.hmark([EMAIL PROTECTED]));
+  var attr2 := [str](b.tmark([EMAIL PROTECTED]));
+  var attrid := new(void,oid,2*count(attr1)).seqbase([EMAIL 
PROTECTED]).append(attr1.project(oid_nil)).append(attr1.project(oid_nil));
+  
attrid.replace(reverse([oid]([lng](reverse(attr_constr(attr1.project(at1qn),attr1,ws).fetch(1))).[*](2LL))));
+  
attrid.replace(reverse([oid]([lng](reverse(attr_constr(attr1.project(at2qn),attr2,ws).fetch(1))).[*](2LL).[+](1LL))));
+  return elem_constr(attr1.mark([EMAIL PROTECTED]),attr1.project(eltqn), 
attrid.mirror().[lng]().[/](2LL).[oid](),
+                                                           
attrid.project(oid_nil), attrid.project(oid_nil),
+                                                           attrid, 
attrid.project(WS), ws).fetch(1);
+}
+
+# execute any mil command..
+PROC ws_mil(BAT[void,BAT] ws, str mil) : any
+{
+   var res := eval(mil);
+   if (type(res) != bat) return str(res);
+   return xmltab2(ws,res);
+}
+
+# create a sequence of elements with 3 attributes, out of a four-column table
+PROC xmltab4(BAT[void,bat] ws,
+             str eltname, BAT[void,str] item,
+             str at1name, BAT[void,str] attr1,
+             str at2name, BAT[void,str] attr2,
+             str at3name, BAT[void,str] attr3) : BAT[void,oid]
+{
+  var eltqn := add_qname ("", "", eltname, ws);
+  var at1qn := add_qname ("", "", at1name, ws);
+  var at2qn := add_qname ("", "", at2name, ws);
+  var at3qn := add_qname ("", "", at3name, ws);
+  var elemid := new(void,oid,4*count(item)).seqbase([EMAIL PROTECTED])
+                                           
.append(item.project(oid_nil)).append(item.project(oid_nil))
+                                           
.append(item.project(oid_nil)).append(item.project(oid_nil));
+  var attrid := elemid.copy().access(BAT_WRITE);
+  elemid.replace(reverse([oid]([lng](reverse(text_constr(item, 
ws).fetch(1))).[*](4LL))));
+  
attrid.replace(reverse([oid]([lng](reverse(attr_constr(attr1.project(at1qn),attr1,ws).fetch(1))).[*](4LL).[+](1LL))));
+  
attrid.replace(reverse([oid]([lng](reverse(attr_constr(attr2.project(at2qn),attr2,ws).fetch(1))).[*](4LL).[+](2LL))));
+  
attrid.replace(reverse([oid]([lng](reverse(attr_constr(attr2.project(at3qn),attr3,ws).fetch(1))).[*](4LL).[+](3LL))));
+  return elem_constr(item.mark([EMAIL PROTECTED]),item.project(eltqn), 
elemid.mirror().[lng]().[/](4LL).[+](1LL).[oid](),
+                                                         elemid, 
[isnil](elemid).[ifthenelse](oid_nil,WS),
+                                                         attrid, 
[isnil](attrid).[ifthenelse](oid_nil,WS), ws).fetch(1);
+}
+
 # fn:collections(), get all collection *names*
-PROC ws_collections(BAT[void,BAT] ws) : BAT[oid,str]
+PROC ws_collections(BAT[void,BAT] ws) : BAT[void,oid]
 {
+    var coll_nme, coll_sze, coll_mbs, coll_upd; 
     pflock_meta(ws_id(ws)); # stop all concurrent shred_doc/del_doc activities
     lock_set(pf_short);
-    var res, err := CATCH(res := 
reverse(collection_name.[startsWith]("::").uselect(false).project([EMAIL 
PROTECTED])).leftjoin(collection_name));
+    var err := CATCH( { coll_nme := 
mirror(collection_name.[startsWith]("::").uselect(false));
+                        coll_sze := 
coll_nme.leftjoin(doc_collection.histogram()).tmark([EMAIL PROTECTED]).[str]();
+                        coll_mbs := [/](coll_nme.leftjoin(collection_size), 
1024LL * 1024LL).tmark([EMAIL PROTECTED]).[str]().[+](" MB"); 
+                        coll_upd := 
coll_nme.[lng]().[str]().[+]("_map_pid").[bat]().[int]().[ttype]().[=](oid).tmark([EMAIL
 PROTECTED]).[str]();
+                        coll_nme := 
coll_nme.leftjoin(collection_name).tmark([EMAIL PROTECTED]); });
     lock_unset(pf_short);
     if (not(isnil(err))) ERROR(err);
-    return res;
+    return xmltab4(ws, "collection", coll_nme, "numDocs", coll_sze, "size", 
coll_mbs, "updatable", coll_upd);
 }
 
 # fn:documents(), get all document *names* in a collection
-PROC ws_documents(BAT[void,BAT] ws, BAT[any,str] coll_nme) : BAT[void,str]
+PROC ws_documents(BAT[void,BAT] ws, BAT[any,str] coll_nme) : BAT[oid,oid]
 {
+    var doc_nme, doc_col, doc_url, doc_upd; 
     pflock_meta(ws_id(ws)); # stop all concurrent shred_doc/del_doc activities
     lock_set(pf_short);
-    var res, err := CATCH(res := coll_nme.tmark([EMAIL 
PROTECTED]).leftjoin(reverse(collection_name)).leftjoin(reverse(doc_collection)).leftjoin(doc_name));
+    var err := CATCH( { doc_nme := 
coll_nme.leftjoin(reverse(collection_name)).leftjoin(reverse(doc_collection));
+                        doc_url := doc_nme.leftjoin(doc_location).tmark([EMAIL 
PROTECTED]);
+                        doc_col := 
doc_nme.leftjoin(doc_collection).tmark([EMAIL PROTECTED]);
+                        doc_upd := 
doc_col.[lng]().[str]().[+]("_map_pid").[bat]().[int]().[ttype]().[=](oid).tmark([EMAIL
 PROTECTED]).[str]();
+                        doc_col := 
doc_col.leftjoin(collection_name).tmark([EMAIL PROTECTED]); 
+                        doc_nme := doc_nme.leftjoin(doc_name); });
     lock_unset(pf_short);
     if (not(isnil(err))) ERROR(err);
-    return res;
+    return doc_nme.mark([EMAIL PROTECTED]).leftfetchjoin(xmltab4(ws, 
"document", doc_nme.tmark([EMAIL PROTECTED]), "collection", doc_col, "url", 
doc_url, "updatable", doc_upd));
 }
 
 # fn:documents(), get all document *names* 
-PROC ws_documents(BAT[void,BAT] ws) : BAT[void,str]
+PROC ws_documents(BAT[void,BAT] ws) : BAT[void,oid]
 {
+    var doc_nme, doc_col, doc_url, doc_upd; 
     pflock_meta(ws_id(ws)); # stop all concurrent shred_doc/del_doc activities
     lock_set(pf_short);
-    var res, err := CATCH(res := 
reverse(doc_name.[startsWith]("::").uselect(false).project([EMAIL 
PROTECTED])).leftjoin(doc_name));
+    var err := CATCH( { doc_nme := 
mirror(doc_name.[startsWith]("::").uselect(false));
+                        doc_url := doc_nme.leftjoin(doc_location).tmark([EMAIL 
PROTECTED]);
+                        doc_col := 
doc_nme.leftjoin(doc_collection).tmark([EMAIL PROTECTED]);
+                        doc_upd := 
doc_col.[lng]().[str]().[+]("_map_pid").[bat]().[int]().[ttype]().[=](oid).tmark([EMAIL
 PROTECTED]).[str]();
+                        doc_nme := doc_nme.leftjoin(doc_name).tmark([EMAIL 
PROTECTED]); 
+                        doc_col := 
doc_col.leftjoin(collection_name).tmark([EMAIL PROTECTED]); });
     lock_unset(pf_short);
     if (not(isnil(err))) ERROR(err);
-    return res;
+    return xmltab4(ws, "document", doc_nme, "collection", doc_col, "url", 
doc_url, "updatable", doc_upd);
 }
 
 


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to