From 436fc3f005c754a78875aa521d5bccbbf1e5c6ad Mon Sep 17 00:00:00 2001 From: "Ray J. Greenwell" Date: Fri, 15 May 2015 15:14:02 -0700 Subject: [PATCH] I have always wanted this constructor. I'm adding it. RFC: I'm continuing to enforce that you must pass at least one SQLExpression, but if we didn't care this could be a bit more straightforward in the form: public Where (SQLExpression... andConditions) It could then use that array directly for the Ops.and(), but also people would be able to make a "where true" by just constructing a Where with no args and I'm not sure mdb is down with that. --- src/main/java/com/samskivert/depot/clause/Where.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/com/samskivert/depot/clause/Where.java b/src/main/java/com/samskivert/depot/clause/Where.java index 5d5775a..78dc841 100644 --- a/src/main/java/com/samskivert/depot/clause/Where.java +++ b/src/main/java/com/samskivert/depot/clause/Where.java @@ -6,6 +6,8 @@ package com.samskivert.depot.clause; import java.util.Collection; +import com.google.common.collect.Lists; + import com.samskivert.depot.Ops; import com.samskivert.depot.PersistentRecord; import com.samskivert.depot.expression.ColumnExp; @@ -51,6 +53,11 @@ public class Where extends WhereClause _condition = condition; } + public Where (SQLExpression condition1, SQLExpression... andConditions) + { + _condition = Ops.and(Lists.asList(condition1, andConditions)); + } + @Override // from WhereClause public SQLExpression getWhereExpression () {