[Swift-commit] r5028 - provenancedb

lgadelha at ci.uchicago.edu lgadelha at ci.uchicago.edu
Tue Aug 30 09:28:16 CDT 2011


Author: lgadelha
Date: 2011-08-30 09:28:16 -0500 (Tue, 30 Aug 2011)
New Revision: 5028

Modified:
   provenancedb/ProvSQL.g
Log:
Minor fixes.


Modified: provenancedb/ProvSQL.g
===================================================================
--- provenancedb/ProvSQL.g	2011-08-30 03:58:00 UTC (rev 5027)
+++ provenancedb/ProvSQL.g	2011-08-30 14:28:16 UTC (rev 5028)
@@ -15,6 +15,7 @@
 	String whereClauseJoinExpressions = new String();
 	String whereClause = new String(); 
 	boolean hasWhereJoinExpression;
+	boolean hasWhereExpression = false;
 	HashSet<String> relations = new HashSet<String>();
 	UndirectedGraph<String,DefaultEdge> schemaGraph;
 	HashSet<DefaultEdge> joinEdges;
@@ -218,13 +219,14 @@
 		)? 
 		selectExpression 
 		{ 
-
 			System.out.print("SELECT " + selectClause);
-			
-
 		}
 		(WHERE whereExpression
 		{
+						hasWhereExpression=true;
+		}
+		)?
+		{
 			schemaGraph = buildGraph();
 			joinEdges = computeJoinEdges(schemaGraph, relations);
 			hasWhereJoinExpression=false;
@@ -240,13 +242,15 @@
 				System.out.print(" WHERE " + whereClauseJoinExpressions);
 			}
 
-			if(hasWhereJoinExpression)
-				System.out.print(" AND ");
-			else
-				System.out.print(" WHERE ");
-			System.out.print(whereClause);
+			if(hasWhereExpression) {
+				if(hasWhereJoinExpression) 
+					System.out.print(" AND ");
+				else 
+					System.out.print(" WHERE ");
+				System.out.print(whereClause);
+			}
 		}
-		)? 
+ 
 		|
 		'(' { System.out.print("("); }
 		squery




More information about the Swift-commit mailing list