本文整理了Java中com.yahoo.squidb.sql.Query.having
方法的一些代码示例,展示了Query.having
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.having
方法的具体详情如下:
包路径:com.yahoo.squidb.sql.Query
类名称:Query
方法名:having
[英]Add a Criterion to the HAVING clause of this query. Multiple calls will combine all the criterions with AND.
[中]将条件添加到此查询的HAVING子句中。多个调用将把所有标准与和结合起来。
代码示例来源:origin: yahoo/squidb
/**
* Add a {@link Criterion} to the HAVING clause of this query. Multiple calls will combine all the criterions with
* AND.
*
* @param criterion the Criterion to add to the HAVING clause
* @return this Query object, to allow chaining method calls
*/
public Query having(Criterion criterion) {
if (criterion == null) {
return this;
}
if (immutable) {
return fork().having(criterion);
}
if (this.havings == null) {
this.havings = new ArrayList<>();
}
this.havings.add(criterion);
invalidateCompileCache();
return this;
}
代码示例来源:origin: yahoo/squidb
public void testBoundArgumentsWorkInHavingClause() {
Query query = Query.select(Employee.PROPERTIES)
.groupBy(Employee.MANAGER_ID)
.having(Function.count(Employee.MANAGER_ID).gt(2));
SquidCursor<Employee> cursor = database.query(Employee.class, query);
try {
assertEquals(1, cursor.getCount());
cursor.moveToFirst();
assertEquals(bigBird.getRowId(), cursor.get(Employee.MANAGER_ID).longValue());
} finally {
cursor.close();
}
}
代码示例来源:origin: yahoo/squidb
subquery.having(Function.count().gt(1));
代码示例来源:origin: com.yahoo.squidb/squidb
/**
* Add a {@link Criterion} to the HAVING clause of this query. Multiple calls will combine all the criterions with
* AND.
*
* @param criterion the Criterion to add to the HAVING clause
* @return this Query object, to allow chaining method calls
*/
public Query having(Criterion criterion) {
if (criterion == null) {
return this;
}
if (immutable) {
return fork().having(criterion);
}
if (this.havings == null) {
this.havings = new ArrayList<>();
}
this.havings.add(criterion);
invalidateCompileCache();
return this;
}
内容来源于网络,如有侵权,请联系作者删除!