void addCondition(StringBuilder builder, List<Object> values, WhereCondition condition) { checkCondition(condition); condition.appendTo(builder, tablePrefix); condition.appendValuesTo(values); }
/** * Shorthand for {@link QueryBuilder#build() build()}.{@link Query#uniqueOrThrow() uniqueOrThrow()}; see * {@link Query#uniqueOrThrow()} for details. To execute a query more than once, you should build the query and * keep * the {@link Query} object for efficiency reasons. */ public T uniqueOrThrow() { return build().uniqueOrThrow(); }
/** * Shorthand for {@link QueryBuilder#buildCount() buildCount()}.{@link CountQuery#count() count()}; see * {@link CountQuery#count()} for details. To execute a query more than once, you should build the query and keep * the {@link CountQuery} object for efficiency reasons. */ public long count() { return buildCount().count(); }
/** * Shorthand for {@link QueryBuilder#build() build()}.{@link Query#unique() unique()}; see {@link Query#unique()} * for details. To execute a query more than once, you should build the query and keep the {@link Query} object for * efficiency reasons. */ public T unique() { return build().unique(); }
/** * Shorthand for {@link QueryBuilder#build() build()}.{@link Query#listLazy() listLazy()}; see * {@link Query#listLazy()} for details. To execute a query more than once, you should build the query and keep the * {@link Query} object for efficiency reasons. */ public LazyList<T> listLazy() { return build().listLazy(); }
/** * Shorthand for {@link QueryBuilder#build() build()}.{@link Query#listLazyUncached() listLazyUncached()}; see * {@link Query#listLazyUncached()} for details. To execute a query more than once, you should build the query and * keep the {@link Query} object for efficiency reasons. */ public LazyList<T> listLazyUncached() { return build().listLazyUncached(); }
/** * Shorthand for {@link QueryBuilder#build() build()}.{@link Query#listIterator() listIterator()}; see * {@link Query#listIterator()} for details. To execute a query more than once, you should build the query and keep * the {@link Query} object for efficiency reasons. */ public CloseableListIterator<T> listIterator() { return build().listIterator(); }
static <T2> Query<T2> create(AbstractDao<T2, ?> dao, String sql, Object[] initialValues, int limitPosition, int offsetPosition) { QueryData<T2> queryData = new QueryData<T2>(dao, sql, toStringArray(initialValues), limitPosition, offsetPosition); return queryData.forCurrentThread(); }
static <T2> CursorQuery<T2> create(AbstractDao<T2, ?> dao, String sql, Object[] initialValues, int limitPosition, int offsetPosition) { QueryData<T2> queryData = new QueryData<T2>(dao, sql, toStringArray(initialValues), limitPosition, offsetPosition); return queryData.forCurrentThread(); }
/** * Executes the query and returns the result as a list iterator; make sure to close it to close the underlying * cursor. The cursor is closed once the iterator is fully iterated through. */ public CloseableListIterator<T> listIterator() { return listLazyUncached().listIteratorAutoClose(); }
static <T2> DeleteQuery<T2> create(AbstractDao<T2, ?> dao, String sql, Object[] initialValues) { QueryData<T2> queryData = new QueryData<T2>(dao, sql, toStringArray(initialValues)); return queryData.forCurrentThread(); }
static <T2> CountQuery<T2> create(AbstractDao<T2, ?> dao, String sql, Object[] initialValues) { QueryData<T2> queryData = new QueryData<T2>(dao, sql, toStringArray(initialValues)); return queryData.forCurrentThread(); }
/** * Adds the given conditions to the where clause using an logical OR. To create new conditions, use the properties * given in the generated dao classes. */ public QueryBuilder<T> whereOr(WhereCondition cond1, WhereCondition cond2, WhereCondition... condMore) { whereCollector.add(or(cond1, cond2, condMore)); return this; }
/** * Adds the given conditions to the where clause using an logical OR. To create new conditions, use the properties * given in the generated dao classes. */ public Join<SRC, DST> whereOr(WhereCondition cond1, WhereCondition cond2, WhereCondition... condMore) { whereCollector.add(or(cond1, cond2, condMore)); return this; }
/** * Creates a WhereCondition by combining the given conditions using AND. The returned WhereCondition must be used * inside {@link #where(WhereCondition, WhereCondition...)} or * {@link #whereOr(WhereCondition, WhereCondition, WhereCondition...)}. */ public WhereCondition and(WhereCondition cond1, WhereCondition cond2, WhereCondition... condMore) { return whereCollector.combineWhereConditions(" AND ", cond1, cond2, condMore); }
/** Adds the given properties to the ORDER BY section using ascending order. */ public QueryBuilder<T> orderAsc(Property... properties) { orderAscOrDesc(" ASC", properties); return this; }
/** Creates an "BETWEEN ... AND ..." condition for this property. */ public WhereCondition between(Object value1, Object value2) { Object[] values = { value1, value2 }; return new PropertyCondition(this, " BETWEEN ? AND ?", values); }
/** * Note: all parameters are reset to their initial values specified in {@link QueryBuilder}. */ public Query<T> forCurrentThread() { return queryData.forCurrentThread(this); }
/** * Creates a WhereCondition by combining the given conditions using OR. The returned WhereCondition must be used * inside {@link #where(WhereCondition, WhereCondition...)} or * {@link #whereOr(WhereCondition, WhereCondition, WhereCondition...)}. */ public WhereCondition or(WhereCondition cond1, WhereCondition cond2, WhereCondition... condMore) { return whereCollector.combineWhereConditions(" OR ", cond1, cond2, condMore); }