Search in sources :

Example 1 with QueryBuilder

use of de.greenrobot.dao.query.QueryBuilder in project UltimateAndroid by cymcsg.

the class GreenDaoUtils method deleteByCondition.

/**
     * 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();
}
Also used : QueryBuilder(de.greenrobot.dao.query.QueryBuilder)

Example 2 with QueryBuilder

use of de.greenrobot.dao.query.QueryBuilder in project UltimateAndroid by cymcsg.

the class GreenDaoUtils method getList.

/**
     * 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;
}
Also used : List(java.util.List) LazyList(de.greenrobot.dao.query.LazyList) QueryBuilder(de.greenrobot.dao.query.QueryBuilder)

Example 3 with QueryBuilder

use of de.greenrobot.dao.query.QueryBuilder in project UltimateAndroid by cymcsg.

the class GreenDaoUtils method getQueryBuilder.

public static QueryBuilder getQueryBuilder(AbstractDao dao, WhereCondition cond, WhereCondition... condmore) {
    setIfLog();
    QueryBuilder qb = dao.queryBuilder();
    qb.where(cond, condmore);
    return qb;
}
Also used : QueryBuilder(de.greenrobot.dao.query.QueryBuilder)

Example 4 with QueryBuilder

use of de.greenrobot.dao.query.QueryBuilder in project UltimateAndroid by cymcsg.

the class GreenDaoUtils method deleteByCondition.

public static void deleteByCondition(AbstractDao dao, WhereCondition cond, WhereCondition... condmore) {
    setIfLog();
    QueryBuilder qb = dao.queryBuilder();
    qb.where(cond, condmore).buildDelete().executeDeleteWithoutDetachingEntities();
}
Also used : QueryBuilder(de.greenrobot.dao.query.QueryBuilder)

Example 5 with QueryBuilder

use of de.greenrobot.dao.query.QueryBuilder in project UltimateAndroid by cymcsg.

the class GreenDaoUtils method getQueryBuilder.

public static QueryBuilder getQueryBuilder(AbstractDao dao, WhereCondition cond, WhereCondition... condmore) {
    setIfLog();
    QueryBuilder qb = dao.queryBuilder();
    qb.where(cond, condmore);
    return qb;
}
Also used : QueryBuilder(de.greenrobot.dao.query.QueryBuilder)

Aggregations

QueryBuilder (de.greenrobot.dao.query.QueryBuilder)6 LazyList (de.greenrobot.dao.query.LazyList)2 List (java.util.List)2