1. tbrugz
  2. queryon

Commits

tbrugz  committed 100d029

queryon: SQL: adding where-clause to query in addProjection()

  • Participants
  • Parent commits 4fc3772
  • Branches default

Comments (0)

Files changed (1)

File src/tbrugz/queryon/SQL.java

View file
 	}
 	
 	public void addProjection(String columns) {
-		sql = "select "+columns+" from ( "+sql+" )"; //XXX: add [where-clause] if it doesn't have already
+		String sqlFilter = "";
+		if(!sql.contains(PARAM_WHERE_CLAUSE) && !sql.contains(PARAM_FILTER_CLAUSE)) {
+			sqlFilter = " " + PARAM_WHERE_CLAUSE;
+		}
+		sql = "select "+columns+" from ( "+sql+" )"+sqlFilter;
 	}
 	
 	public void addLimitOffset(LimitOffsetStrategy strategy, RequestSpec reqspec) throws ServletException {