Java Code Examples for de.greenrobot.dao.AbstractDao#queryBuilder()

The following examples show how to use de.greenrobot.dao.AbstractDao#queryBuilder() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GreenDaoUtils.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
/**
 * Executes the query and returns the result as a list containing all entities loaded into memory.
 * @param dao
 * @param isAsc
 * @param orderProperty
 * @return
 */
public static List getList(AbstractDao dao, boolean isAsc, Property... orderProperty) {
    setIfLog();
    QueryBuilder queryBuilder = dao.queryBuilder();
    if (isAsc) {
        queryBuilder = queryBuilder.orderAsc(orderProperty);
    } else {
        queryBuilder = queryBuilder.orderDesc(orderProperty);
    }
    List indexFavList = queryBuilder.list();
    return indexFavList;
}
 
Example 2
Source File: GreenDaoUtils.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
public static List getList(AbstractDao dao, boolean isAsc, Property... orderProperty) {
    setIfLog();
    QueryBuilder queryBuilder = dao.queryBuilder();
    if (isAsc) {
        queryBuilder = queryBuilder.orderAsc(orderProperty);
    } else {
        queryBuilder = queryBuilder.orderDesc(orderProperty);
    }
    List indexFavList = queryBuilder.list();
    return indexFavList;
}
 
Example 3
Source File: GreenDaoUtils.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
/**
 * Executes the query and returns the result as a list containing all entities loaded into memory.
 * @param dao
 * @param isAsc
 * @param orderProperty
 * @return
 */
public static List getList(AbstractDao dao, boolean isAsc, Property... orderProperty) {
    setIfLog();
    QueryBuilder queryBuilder = dao.queryBuilder();
    if (isAsc) {
        queryBuilder = queryBuilder.orderAsc(orderProperty);
    } else {
        queryBuilder = queryBuilder.orderDesc(orderProperty);
    }
    List indexFavList = queryBuilder.list();
    return indexFavList;
}
 
Example 4
Source File: GreenDaoUtils.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
public static QueryBuilder getQueryBuilder(AbstractDao dao, WhereCondition cond, WhereCondition... condmore) {
    setIfLog();
    QueryBuilder qb = dao.queryBuilder();
    qb.where(cond, condmore);
    return qb;
}
 
Example 5
Source File: GreenDaoUtils.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
public static QueryBuilder getQueryBuilder(AbstractDao dao, WhereCondition cond, WhereCondition... condmore) {
    setIfLog();
    QueryBuilder qb = dao.queryBuilder();
    qb.where(cond, condmore);
    return qb;
}
 
Example 6
Source File: GreenDaoUtils.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
public static void deleteByCondition(AbstractDao dao, WhereCondition cond, WhereCondition... condmore) {
    setIfLog();
    QueryBuilder qb = dao.queryBuilder();
    qb.where(cond, condmore).buildDelete().executeDeleteWithoutDetachingEntities();

}
 
Example 7
Source File: GreenDaoUtils.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
public static QueryBuilder getQueryBuilder(AbstractDao dao, WhereCondition cond, WhereCondition... condmore) {
    setIfLog();
    QueryBuilder qb = dao.queryBuilder();
    qb.where(cond, condmore);
    return qb;
}
 
Example 8
Source File: GreenDaoUtils.java    From UltimateAndroid with Apache License 2.0 3 votes vote down vote up
/**
 * Deletes all matching entities without detaching them from the identity scope (aka session/cache). Note that this
 * method may lead to stale entity objects in the session cache. Stale entities may be returned when loaded by their
 * primary key, but not using queries.
 * @param dao
 * @param cond
 * @param condmore
 */
public static void deleteByCondition(AbstractDao dao, WhereCondition cond, WhereCondition... condmore) {
    setIfLog();
    QueryBuilder qb = dao.queryBuilder();
    qb.where(cond, condmore).buildDelete().executeDeleteWithoutDetachingEntities();

}
 
Example 9
Source File: GreenDaoUtils.java    From UltimateAndroid with Apache License 2.0 3 votes vote down vote up
/**
 * Deletes all matching entities without detaching them from the identity scope (aka session/cache). Note that this
 * method may lead to stale entity objects in the session cache. Stale entities may be returned when loaded by their
 * primary key, but not using queries.
 * @param dao
 * @param cond
 * @param condmore
 */
public static void deleteByCondition(AbstractDao dao, WhereCondition cond, WhereCondition... condmore) {
    setIfLog();
    QueryBuilder qb = dao.queryBuilder();
    qb.where(cond, condmore).buildDelete().executeDeleteWithoutDetachingEntities();

}