當前位置: 首頁>>代碼示例>>Java>>正文


Java QueryBuilder.query方法代碼示例

本文整理匯總了Java中com.j256.ormlite.stmt.QueryBuilder.query方法的典型用法代碼示例。如果您正苦於以下問題:Java QueryBuilder.query方法的具體用法?Java QueryBuilder.query怎麽用?Java QueryBuilder.query使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.j256.ormlite.stmt.QueryBuilder的用法示例。


在下文中一共展示了QueryBuilder.query方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getFocusList

import com.j256.ormlite.stmt.QueryBuilder; //導入方法依賴的package包/類
/**
 * 返回完整Focus List
 * 
 * @param module
 * @return
 */
public List<FocusItemInfo> getFocusList()
{
	List<FocusItemInfo> koItemInfoList = null;
	try
	{
		QueryBuilder<FocusItemInfo, Long> queryBuilder = mFocusItemInfoDao.queryBuilder();
		// queryBuilder.groupBy("category");
		queryBuilder.orderBy("order_by", true);
		koItemInfoList = queryBuilder.query();
	}
	catch (SQLException e)
	{
		e.printStackTrace();
	}
	
	return koItemInfoList;
}
 
開發者ID:benniaobuguai,項目名稱:android-project-gallery,代碼行數:24,代碼來源:LocalAlbumBiz.java

示例2: getLatest

import com.j256.ormlite.stmt.QueryBuilder; //導入方法依賴的package包/類
public List<MerchantService> getLatest(Long limit, Long offset) throws IOException {

        try {

            QueryBuilder<MerchantService, String> queryBuilder = dao.queryBuilder();
            queryBuilder.orderBy(MerchantService.PURCHASE_DATE_FIELD_NAME, false);
            queryBuilder.limit(limit);
            queryBuilder.offset(offset);

            List<MerchantService> results = queryBuilder.query();
            refresh(results);

            return results;
        } catch (Exception e) {
            throw new IOException(e);
        }

    }
 
開發者ID:remipassmoilesel,項目名稱:simple-hostel-management,代碼行數:19,代碼來源:MerchantServiceService.java

示例3: getByTagSync

import com.j256.ormlite.stmt.QueryBuilder; //導入方法依賴的package包/類
private static List<Long> getByTagSync(final long tagId) {
    final RuntimeExceptionDao<MyTagPhoto, Long> daoTagPhoto = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyTagPhoto.class);
    try {
        QueryBuilder<MyTagPhoto, Long> tagPhotoQb = daoTagPhoto.queryBuilder();
        tagPhotoQb.where().eq("tagId", tagId);
        List<MyTagPhoto> tagPhotos = tagPhotoQb.query();
        List<Long> photoIds = new ArrayList<>();
        for (MyTagPhoto tp : tagPhotos) {
            photoIds.add(tp.photoId);
        }

        return photoIds;
    } catch (Exception e) {
        Log.w(TAG, e.getMessage());
        return null;
    }
}
 
開發者ID:aliyun,項目名稱:aliyun-cloudphotos-android-demo,代碼行數:18,代碼來源:MyTagPhoto.java

示例4: getLatest

import com.j256.ormlite.stmt.QueryBuilder; //導入方法依賴的package包/類
public List<Customer> getLatest(Long limit, Long offset) throws IOException {

        try {

            QueryBuilder<Customer, String> queryBuilder = dao.queryBuilder();
            queryBuilder.orderBy(Customer.CREATIONDATE_FIELD_NAME, false);
            queryBuilder.limit(limit);
            queryBuilder.offset(offset);

            List<Customer> results = queryBuilder.query();
            refresh(results);

            return results;
        } catch (Exception e) {
            throw new IOException(e);
        }

    }
 
開發者ID:remipassmoilesel,項目名稱:simple-hostel-management,代碼行數:19,代碼來源:CustomerService.java

示例5: getAll

import com.j256.ormlite.stmt.QueryBuilder; //導入方法依賴的package包/類
/**
 * This method do not return deleted resources
 *
 * @param type
 * @return
 * @throws IOException
 */
public List<Accommodation> getAll(Type type) throws IOException {

    if (type == null) {
        throw new NullPointerException("Type is null");
    }

    try {
        QueryBuilder builder = dao.queryBuilder();
        builder.where().eq(Accommodation.TYPE_FIELD_NAME, type);
        builder.where().eq(Accommodation.DELETED_FIELD_NAME, false);
        return builder.query();
    } catch (SQLException e) {
        throw new IOException(e);
    }
}
 
開發者ID:remipassmoilesel,項目名稱:simple-hostel-management,代碼行數:23,代碼來源:AccommodationService.java

示例6: getByAccommodationId

import com.j256.ormlite.stmt.QueryBuilder; //導入方法依賴的package包/類
public List<Reservation> getByAccommodationId(Long accommodationId, long limit, long offset, boolean orderAscending) throws IOException {

        try {
            QueryBuilder queryBuilder = dao.queryBuilder();
            queryBuilder.where().eq(Reservation.ACCOMMODATION_FIELD_NAME, accommodationId);
            queryBuilder.orderBy(Reservation.DATEBEGIN_FIELD_NAME, orderAscending);
            queryBuilder.limit(limit);
            queryBuilder.offset(offset);

            List results = queryBuilder.query();
            refresh(results);

            return results;
        } catch (SQLException e) {
            throw new IOException(e);
        }
    }
 
開發者ID:remipassmoilesel,項目名稱:simple-hostel-management,代碼行數:18,代碼來源:ReservationService.java

示例7: getScoreListOrderByDate

import com.j256.ormlite.stmt.QueryBuilder; //導入方法依賴的package包/類
/**
 * 排行榜, 按時間排序
 * 
 * @param offset
 * @param count
 * @return
 */
public List<GameRanking> getScoreListOrderByDate(long offset, long count)
{
	QueryBuilder<GameRanking, ?> qb = getDao().queryBuilder();
	try
	{
		// qb.where().eq("user_name", userName);
		qb.offset(offset);
		qb.limit(count);
		qb.orderBy("record_date", false);

		return qb.query();
	}
	catch (SQLException e)
	{
		e.printStackTrace();
	}

	return null;
}
 
開發者ID:benniaobuguai,項目名稱:android-project-gallery,代碼行數:27,代碼來源:GameRankingBiz.java

示例8: queryGeByOrder

import com.j256.ormlite.stmt.QueryBuilder; //導入方法依賴的package包/類
/**
 * 排序查詢指定條件下,大於指定值的所有記錄
 *
 * @param orderColumn 大於的列
 * @param limitValue  大於的值
 * @param columnName  查詢條件列名
 * @param value       查詢條件值
 * @param ascending   true為升序,false為降序
 * @return
 */
public List<T> queryGeByOrder(String orderColumn, Object limitValue, String columnName, Object value, boolean ascending) {
    List<T> list = null;
    QueryBuilder queryBuilder = ormLiteDao.queryBuilder();
    Where where = queryBuilder.where();
    try {
        where.eq(columnName, value);
        where.and().ge(orderColumn, limitValue);
        queryBuilder.orderBy(orderColumn, ascending);
        list = queryBuilder.query();
    } catch (SQLException e) {
        LogUtils.e(e);
    }
    return list;

}
 
開發者ID:lujianzhao,項目名稱:AndroidBase,代碼行數:26,代碼來源:OrmLiteDao.java

示例9: queryForPagesByOrder

import com.j256.ormlite.stmt.QueryBuilder; //導入方法依賴的package包/類
/**
 * 分頁查詢,並按列排序
 *
 * @param orderColumn 排序列名
 * @param ascending   true為升序,false為降序
 * @param offset      搜索下標
 * @param count       搜索條數
 * @return 分頁查詢後的數據集
 */
public List<T> queryForPagesByOrder(String orderColumn, boolean ascending, Long offset, Long count) {
    List<T> list = null;
    QueryBuilder queryBuilder = ormLiteDao.queryBuilder();
    Where where = queryBuilder.where();
    try {
        where.isNotNull(orderColumn);
        queryBuilder.orderBy(orderColumn, ascending);
        queryBuilder.offset(offset);
        queryBuilder.limit(count);
        list = queryBuilder.query();
    } catch (SQLException e) {
        LogUtils.e(e);
    }
    return list;
}
 
開發者ID:lujianzhao,項目名稱:AndroidBase,代碼行數:25,代碼來源:OrmLiteDao.java

示例10: getScoreListOrderByScore

import com.j256.ormlite.stmt.QueryBuilder; //導入方法依賴的package包/類
/**
 * 排行榜, 按積分排序
 * 
 * @param offset
 * @param count
 * @return
 */
public List<GameRanking> getScoreListOrderByScore(long offset, long count)
{
	QueryBuilder<GameRanking, ?> qb = getDao().queryBuilder();
	try
	{
		// qb.where().eq("user_name", userName);
		qb.offset(offset);
		qb.limit(count);
		qb.orderBy("score", true);
		return qb.query();
	}
	catch (SQLException e)
	{
		e.printStackTrace();
	}

	return null;
}
 
開發者ID:benniaobuguai,項目名稱:android-project-wo2b,代碼行數:26,代碼來源:GameRankingBiz.java

示例11: onDataSetChanged

import com.j256.ormlite.stmt.QueryBuilder; //導入方法依賴的package包/類
@Override
public void onDataSetChanged() {
    Log.i("ZULIP_WIDGET", "onDataSetChanged() = Data reloaded");
    QueryBuilder<Message, Object> queryBuilder = ZulipApp.get().getDao(Message.class).queryBuilder();
    String filter;
    filter = setupWhere();
    if (!filter.equals("")) {
        queryBuilder.where().raw(filter);
    }

    try {
        messageList = queryBuilder.query();
    } catch (SQLException e) {
        ZLog.logException(e);
    }
}
 
開發者ID:zulip,項目名稱:zulip-android,代碼行數:17,代碼來源:ZulipRemoteViewsFactory.java

示例12: getDiaryTalks

import com.j256.ormlite.stmt.QueryBuilder; //導入方法依賴的package包/類
public static List<Talk> getDiaryTalks(Context context){
    DataBaseHelper dataBaseHelper = OpenHelperManager.getHelper(context, DataBaseHelper.class);
    try {
        QueryBuilder<Talk, String> builder = dataBaseHelper.getTalkDao().queryBuilder();
        builder.orderBy("order",true);
        Where<Talk,String> where = builder.where();
        where.eq("scheduled", true);
        List<Talk> talkList = builder.query();
        if(!talkList.isEmpty() && talkList!=null) {
            return talkList;
        }
    } catch (SQLException e) {
        e.printStackTrace();
    }
    return null;
}
 
開發者ID:viniciusDSL,項目名稱:Google-I-O-extended,代碼行數:17,代碼來源:TalkController.java

示例13: getPrivateOrgGroup

import com.j256.ormlite.stmt.QueryBuilder; //導入方法依賴的package包/類
protected DBGroup getPrivateOrgGroup(DBGroup organization, DBIdentity member)
    throws SQLException {
  // get all of member's groups
  QueryBuilder<DBAcl, Integer> directMemberQuery =
      manager.aclDao.queryBuilder().selectColumns(DBAcl.GROUP_ID_FIELD_NAME);
  directMemberQuery.where().eq(DBAcl.MEMBER_IDENTITY_FIELD_NAME, member.getId());

  // from those groups, get the groups that are also part of organization
  QueryBuilder<DBAcl, Integer> query = manager.aclDao.queryBuilder();
  query.where().in(DBAcl.GROUP_ID_FIELD_NAME, directMemberQuery).and()
      .eq(DBAcl.MEMBER_GROUP_FIELD_NAME, organization.getId());

  // find the private group from the list organization groups this user belongs to
  for (DBAcl acl : query.query()) {
    DBGroup group = acl.loadGroup(manager.groupDao);
    if (group.isPrivateUserGroup()) {
      return group;
    }
  }

  fail("did not find member's private organization group");
  return null;
}
 
開發者ID:WeAreWizards,項目名稱:passopolis-server,代碼行數:24,代碼來源:MemoryDBFixture.java

示例14: queryByExtension

import com.j256.ormlite.stmt.QueryBuilder; //導入方法依賴的package包/類
/**
 * Query by extension name, table name, and column name
 * 
 * @param extensionName
 *            extension name
 * @param tableName
 *            table name
 * @param columnName
 *            column name
 * @return extensions
 * @throws SQLException
 */
public Extensions queryByExtension(String extensionName, String tableName,
		String columnName) throws SQLException {

	QueryBuilder<Extensions, Void> qb = queryBuilder();

	setUniqueWhere(qb.where(), extensionName, true, tableName, true,
			columnName);

	List<Extensions> extensions = qb.query();

	Extensions extension = null;
	if (extensions.size() > 1) {
		throw new GeoPackageException("More than one "
				+ Extensions.class.getSimpleName()
				+ " existed for unique combination of Extension Name: "
				+ extensionName + ", Table Name: " + tableName
				+ ", Column Name: " + columnName);
	} else if (extensions.size() == 1) {
		extension = extensions.get(0);
	}

	return extension;
}
 
開發者ID:ngageoint,項目名稱:geopackage-core-java,代碼行數:36,代碼來源:ExtensionsDao.java

示例15: queryByUnique

import com.j256.ormlite.stmt.QueryBuilder; //導入方法依賴的package包/類
/**
 * Query by the unique column values
 * 
 * @param constraintName
 *            constraint name
 * @param constraintType
 *            constraint type
 * @param value
 *            value
 * @return data column constraints
 * @throws SQLException
 */
public DataColumnConstraints queryByUnique(String constraintName,
		DataColumnConstraintType constraintType, String value)
		throws SQLException {

	DataColumnConstraints constraint = null;

	QueryBuilder<DataColumnConstraints, Void> qb = queryBuilder();
	setUniqueWhere(qb.where(), constraintName, constraintType, value);
	List<DataColumnConstraints> constraints = qb.query();
	if (!constraints.isEmpty()) {

		if (constraints.size() > 1) {
			throw new GeoPackageException("More than one "
					+ DataColumnConstraints.class.getSimpleName()
					+ " was found for unique constraint. Name: "
					+ constraintName + ", Type: " + constraintType
					+ ", Value: " + value);
		}

		constraint = constraints.get(0);
	}

	return constraint;
}
 
開發者ID:ngageoint,項目名稱:geopackage-core-java,代碼行數:37,代碼來源:DataColumnConstraintsDao.java


注:本文中的com.j256.ormlite.stmt.QueryBuilder.query方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。