Update of /cvsroot/monetdb/pathfinder/compiler/debug
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv9451/compiler/debug

Modified Files:
        logdebug.c 
Log Message:
-- Added generic properties-support for plan-bundles. A (algebraic- or 
sql-code-) plan-bundle now can have some meta-data attached in the form of an 
arbitrary amount of arbitrarily nestable properties (key-value pairs). Such 
properties are totally ignored by pathfinder itself, but they can be used to 
carry some specific information from the input-data to the output-data.

U logdebug.c
Index: logdebug.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/debug/logdebug.c,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -d -r1.130 -r1.131
--- logdebug.c  12 Jun 2009 13:06:14 -0000      1.130
+++ logdebug.c  31 Jul 2009 13:06:21 -0000      1.131
@@ -2697,6 +2697,43 @@
     la_xml_internal (f, root, prop_args);
 }
 
+
+void
+PFla_xml_qp_property (
+       FILE *f, PFla_pb_item_property_t property, unsigned int nest)
+{
+
+       char *nestSpaces;
+       nestSpaces = (char *) PFmalloc (nest + 1);
+       for(unsigned int i = 0; i < nest; i++)
+       {
+               nestSpaces[i] = ' ';
+       }
+       nestSpaces[nest] = '\0';
+
+       fprintf (f, "%s<property name=\"%s\" value=\"%s\"",
+                       nestSpaces, property.name, property.value);
+       if (property.properties)
+       {
+               fprintf (f, ">\n");
+               for (unsigned int i = 0;
+                        i < PFarray_last (property.properties);
+                i++)
+               {
+                       PFla_pb_item_property_t subProperty =
+                               *((PFla_pb_item_property_t*) PFarray_at (
+                                                                               
                property.properties, i));
+                       PFla_xml_qp_property (f, subProperty, nest+2);
+               }
+               fprintf (f, "%s</property>\n", nestSpaces);
+       }
+       else
+       {
+               fprintf (f, "/>\n");
+       }
+
+}
+
 /**
  * Dump algebra plan bundle in XML format
  *
@@ -2708,22 +2745,40 @@
 {
     PFla_op_t *root;
     int        id, idref, colref;
+    PFarray_t *properties;
 
     fprintf (f, 
              "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
              "<query_plan_bundle>\n");
 
     for (unsigned int i = 0; i < PFla_pb_size(lapb); i++) {
-        root   = PFla_pb_op_at (lapb, i);
-        id     = PFla_pb_id_at (lapb, i);
-        idref  = PFla_pb_idref_at (lapb, i);
-        colref = PFla_pb_colref_at (lapb, i);
+        root       = PFla_pb_op_at (lapb, i);
+        id         = PFla_pb_id_at (lapb, i);
+        idref      = PFla_pb_idref_at (lapb, i);
+        colref     = PFla_pb_colref_at (lapb, i);
+        properties = PFla_pb_properties_at (lapb, i);
         
         fprintf (f, "<query_plan id=\"%i\"", id);
         if (idref != -1)
             fprintf (f, " idref=\"%i\" colref=\"%i\"", idref, colref);
         fprintf (f, ">\n");
 
+        if (properties)
+        {
+               fprintf (f, "  <properties>\n");
+               for (unsigned int i = 0;
+                                               i < PFarray_last (properties);
+                                   i++)
+                       {
+                               PFla_pb_item_property_t property =
+                                       *((PFla_pb_item_property_t*) PFarray_at 
(properties, i));
+                               PFla_xml_qp_property (f, property, 4);
+                       }
+
+
+               fprintf (f, "  </properties>\n");
+        }
+
         assert (root);
         la_xml_internal (f, root, prop_args);
 


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to