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.
This commit is contained in:
Ray J. Greenwell
2015-05-15 15:14:02 -07:00
parent 3adbc2b807
commit 436fc3f005
@@ -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 ()
{