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

Modified Files:
        main_sql.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 main_sql.c
Index: main_sql.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/main_sql.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- main_sql.c  16 Jun 2009 14:35:50 -0000      1.12
+++ main_sql.c  31 Jul 2009 13:06:21 -0000      1.13
@@ -180,6 +180,46 @@
         fputs (PFerrbuf, stderr);\
         exit (rtrn);
 
+
+
+
+void
+print_property (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 (stdout, "%s<property name=\"%s\" value=\"%s\"",
+                       nestSpaces, property.name, property.value);
+       if (property.properties)
+       {
+               fprintf (stdout, ">\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));
+                       print_property (subProperty, nest+2);
+               }
+               fprintf (stdout, "%s</property>\n", nestSpaces);
+       }
+       else
+       {
+               fprintf (stdout, "/>\n");
+       }
+
+}
+
+
+
 /**
  * Entry point to the Pathfinder compiler,
  * parses the command line (switches), then invokes the compiler driver
@@ -364,6 +404,22 @@
                          PFla_pb_idref_at (lapb, i),
                          PFla_pb_colref_at (lapb, i));
             fprintf (stdout, ">\n");
+
+            if (PFla_pb_properties_at (lapb, i))
+                       {
+                               fprintf (stdout, "  <properties>\n");
+                               for (unsigned int propertyID = 0;
+                                       propertyID < PFarray_last 
(PFla_pb_properties_at (lapb, i));
+                                       propertyID++)
+                               {
+                                       PFla_pb_item_property_t property =
+                                               *((PFla_pb_item_property_t*) 
PFarray_at
+                                                               
(PFla_pb_properties_at (lapb, i), propertyID));
+                                       print_property (property, 4);
+                               }
+                               fprintf (stdout, "  </properties>\n");
+                       }
+
             fprintf (stdout,
                      "<schema>\n"
                      "  <column name=\"%s\" function=\"iter\"/>\n",


------------------------------------------------------------------------------
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