Update of /cvsroot/monetdb/pathfinder/compiler/debug
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv21618/debug

Modified Files:
        prettysql.c 
Log Message:
-- Also prettyprint conjunctive where list.
   (This makes the generated output much more readable.)


Index: prettysql.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/debug/prettysql.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- prettysql.c 10 Jul 2007 14:10:28 -0000      1.11
+++ prettysql.c 18 Jul 2007 09:27:02 -0000      1.12
@@ -96,7 +96,7 @@
 
 /* forward declarations for the left site of grammar rules */
 static void print_statement(PFsql_t*);
-static void print_expr(PFsql_t*);
+static void print_expr (PFsql_t*);
 static void print_fullselect(FILE*,PFsql_t*,int);
 
 static void 
@@ -227,7 +227,30 @@
 }
 
 static void
-print_expr(PFsql_t *n)
+print_conjunctive_list (FILE *f, PFsql_t *n, int i)
+{
+    assert (n);
+
+    switch (n->kind) {
+        case sql_and:
+            print_conjunctive_list (f, L(n), i);
+            indent (f, i-4);
+            fprintf (f, "AND ");
+            print_conjunctive_list (f, R(n), i);
+            break;
+
+        default:
+            /* prettyprint a single expression */
+            PFprettyprintf ("%c", START_BLOCK);
+            print_expr (n);
+            PFprettyprintf ("%c", END_BLOCK);
+            pretty_dump (f, i);
+            break;
+    }
+}
+
+static void
+print_expr (PFsql_t *n)
 {
     assert (n);
 
@@ -664,12 +687,7 @@
             print_join (f, L(n), i);
             indent (f, i-3);
             fprintf (f, "ON ");
-
-            /* prettyprint expression */
-            PFprettyprintf ("%c", START_BLOCK);
-            print_expr (R(n));
-            PFprettyprintf ("%c", END_BLOCK);
-            pretty_dump (f, i);
+            print_conjunctive_list (f, R(n), i);
             break;
             
         case sql_innr_join:
@@ -776,12 +794,7 @@
             if (n->child[2]) {
                 indent (f, i);
                 fprintf (f, " WHERE ");
-
-                /* prettyprint where list */
-                PFprettyprintf ("%c", START_BLOCK);
-                print_expr (n->child[2]);
-                PFprettyprintf ("%c", END_BLOCK);
-                pretty_dump (f, i+7);
+                print_conjunctive_list (f, n->child[2], i+7);
             }
 
             /* GROUP BY (optional) */


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to