Update of /cvsroot/monetdb/pathfinder/src/sqlhelpers/xmlshred
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv20433

Modified Files:
        encoding.c main.c 
Log Message:
-- extend shredder to emit ORDPATH ranks.


U encoding.c
Index: encoding.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/src/sqlhelpers/xmlshred/encoding.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- encoding.c  8 Jan 2009 16:54:18 -0000       1.24
+++ encoding.c  23 Mar 2009 17:13:04 -0000      1.25
@@ -216,6 +216,14 @@
 static void lambda_O (node_t n) 
 { fprintf (out, SSZFMT, n.post_stretched); }
 
+static void lambda_h (node_t n) 
+{ if (n.parent) {
+      lambda_h (*(n.parent));
+      fprintf (out, SSZFMT, n.parent->children + 1);
+  }
+  fprintf (out, "/");
+}
+
 static void lambda_s (node_t n) 
 { fprintf (out, SSZFMT, n.size); }
 
@@ -255,6 +263,7 @@
   , ['o'] = lambda_o 
   , ['E'] = lambda_E 
   , ['O'] = lambda_O 
+  , ['h'] = lambda_h 
   , ['s'] = lambda_s 
   , ['l'] = lambda_l 
   , ['k'] = lambda_k
@@ -398,6 +407,7 @@
       , .post_stretched = rank + 1
       , .parent         = stack + level - 1
       , .size           = 0
+      , .children       = 0
       , .level          = level
       , .kind           = kind
       , .localname      = xmlStrdup (localname)
@@ -422,6 +432,8 @@
     if (stack[level].value)     xmlFree (stack[level].value);
 
     level--;
+    /* add one more child node */
+    stack[level].children++;
 }
 
 static void
@@ -459,6 +471,7 @@
         , .post_stretched = 0
         , .parent         = NULL
         , .size           = 0
+        , .children       = 0
         , .level          = level
         , .kind           = doc
         , .localname      = NULL
@@ -547,6 +560,7 @@
       , .post_stretched = 0
       , .parent         = stack + level - 1
       , .size           = 0
+      , .children       = 0
       , .level          = level
       , .kind           = elem
       , .localname      = xmlStrdup (localname)
@@ -660,6 +674,8 @@
         xmlFree (stack[level].value);
 
     level--;
+    /* add one more child node */
+    stack[level].children++;
     assert (level >= 0);    
 }   
 

U main.c
Index: main.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/src/sqlhelpers/xmlshred/main.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- main.c      8 Jan 2009 16:54:18 -0000       1.15
+++ main.c      23 Mar 2009 17:13:04 -0000      1.16
@@ -164,6 +164,7 @@
             "\t%%o: node postorder rank\n"
             "\t%%E: node preorder rank in stretched pre/post plane\n"
             "\t%%O: node postorder rank in stretched pre/post plane\n"
+            "\t%%h: node ORDPATH label as required by SQL SERVERs hierarchyid 
type\n"
             "\t%%s: size of subtree below node\n"
             "\t%%l: length of path from root to node (level)\n"
             "\t%%k: node kind\n"


------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to