• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java WhereCondition类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.greenrobot.greendao.query.WhereCondition的典型用法代码示例。如果您正苦于以下问题:Java WhereCondition类的具体用法?Java WhereCondition怎么用?Java WhereCondition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



WhereCondition类属于org.greenrobot.greendao.query包,在下文中一共展示了WhereCondition类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testEqByteArray

import org.greenrobot.greendao.query.WhereCondition; //导入依赖的package包/类
public void testEqByteArray() {
    ArrayList<TestEntity> inserted = insert(3);
    TestEntity testEntity = inserted.get(1);

    byte[] byteArray = {96, 77, 37, -21};
    testEntity.setSimpleByteArray(byteArray);
    dao.update(testEntity);

    // Unsupported: Query<TestEntity> query = dao.queryBuilder().where(Properties.SimpleByteArray.eq(byteArray)).build();

    // Works, but probably voids any index on BLOBs (Note: there's no hex2blob function and X'?' is bad syntax):
    // String conditionString = "HEX(" + Properties.SimpleByteArray.columnName + ")=?";
    // WhereCondition condition = new WhereCondition.StringCondition(conditionString, SqlUtils.toHex(byteArray));

    String conditionString = Properties.SimpleByteArray.columnName + '=' + SqlUtils.escapeBlobArgument(byteArray);
    WhereCondition condition = new WhereCondition.StringCondition(conditionString);
    Query<TestEntity> query = dao.queryBuilder().where(condition).build();
    TestEntity testEntity2 = query.uniqueOrThrow();
    assertEquals(testEntity.getId(), testEntity2.getId());

    // Unsupported: query.setParameter(0, new byte[]{96, 77, 37, -21, 99});
    // Unsupported: assertNull(query.unique());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:QueryBuilderSimpleTest.java


示例2: testMockitoMocks

import org.greenrobot.greendao.query.WhereCondition; //导入依赖的package包/类
@Test
public void testMockitoMocks() {
    mock(DaoMaster.class).newSession();
    mock(DaoSession.class).getDatabase();
    mock(Database.class).getRawDatabase();
    mock(DatabaseStatement.class).execute();
    mock(IdentityScope.class).clear();
    mock(AbstractDao.class).queryBuilder();
    mock(MinimalEntityDao.class).queryBuilder();
    mock(MinimalEntity.class).getId();
    mock(Query.class).forCurrentThread();
    mock(QueryBuilder.class).build();
    mock(CountQuery.class).forCurrentThread();
    mock(DeleteQuery.class).forCurrentThread();
    mock(Join.class).getTablePrefix();
    mock(LazyList.class).getLoadedCount();
    mock(WhereCondition.class).appendValuesTo(null);
    mock(Property.class).isNull();
    mock(DaoException.class).getMessage();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:OptionalDepedenciesTest.java


示例3: selectData

import org.greenrobot.greendao.query.WhereCondition; //导入依赖的package包/类
void selectData(String name, String phoneNum, String sex, final MaterialDialog materialDialog) {

        Logger.t(TAG).i("name=" + name + "\nphoneNum=" + phoneNum + "\nsex=" + sex);
        WhereCondition nameWhereCondition = UserDao.Properties.Name.like("%" + name + "%");
        WhereCondition phoneNumWhereCondition = UserDao.Properties.PhoneNumber.like("%" + phoneNum + "%");
        WhereCondition sexWhereCondition = UserDao.Properties.Sex.eq(sex);

        List<User> users;

        if (TextUtils.isEmpty(sex)) {
            users = mUserDao.queryBuilder().where(nameWhereCondition, phoneNumWhereCondition).list();
        } else {
            users = mUserDao.queryBuilder().where(nameWhereCondition, phoneNumWhereCondition, sexWhereCondition).list();
        }

        loadLatestData(users);
        materialDialog.dismiss();
    }
 
开发者ID:chenzj-king,项目名称:GreenDaoSample,代码行数:19,代码来源:SelectFragment.java


示例4: get

import org.greenrobot.greendao.query.WhereCondition; //导入依赖的package包/类
/**
 * 根据指定地址名称或经纬度查询地址
 **/
public BaiduAddress get(BaiduAddress baiduAddress) {
    DecimalFormat df = new DecimalFormat("0.0000");
    WhereCondition andCondition = mAddressDao.queryBuilder().and(BaiduAddressDao.Properties.Latitude.like(df.format(baiduAddress.getLatitude()) + "%"),
            BaiduAddressDao.Properties.Longitude.like(df.format(baiduAddress.getLongitude()) + "%"));
    return mAddressDao.queryBuilder().whereOr(BaiduAddressDao.Properties.Address.eq(baiduAddress.getAddress())
            , andCondition).orderDesc(BaiduAddressDao.Properties.FavoritedTime).limit(1).unique();
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:11,代码来源:BaiduNaviDao.java


示例5: isEntityExists

import org.greenrobot.greendao.query.WhereCondition; //导入依赖的package包/类
public static boolean isEntityExists(AbstractDao dao, WhereCondition condition) {
    return dao.queryBuilder()
            .where(condition)
            .build()
            .list()
            .size() >= 1;
}
 
开发者ID:Glooory,项目名称:FlatReader,代码行数:8,代码来源:GreenDaoUtils.java


示例6: eq

import org.greenrobot.greendao.query.WhereCondition; //导入依赖的package包/类
/** Creates an "equal ('=')" condition  for this property. */
public WhereCondition eq(Object value) {
    return new PropertyCondition(this, "=?", value);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:Property.java


示例7: notEq

import org.greenrobot.greendao.query.WhereCondition; //导入依赖的package包/类
/** Creates an "not equal ('<>')" condition  for this property. */
public WhereCondition notEq(Object value) {
    return new PropertyCondition(this, "<>?", value);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:Property.java


示例8: like

import org.greenrobot.greendao.query.WhereCondition; //导入依赖的package包/类
/** Creates an "LIKE" condition  for this property. */
public WhereCondition like(String value) {
    return new PropertyCondition(this, " LIKE ?", value);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:Property.java


示例9: between

import org.greenrobot.greendao.query.WhereCondition; //导入依赖的package包/类
/** 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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:Property.java


示例10: in

import org.greenrobot.greendao.query.WhereCondition; //导入依赖的package包/类
/** Creates an "IN (..., ..., ...)" condition  for this property. */
public WhereCondition in(Object... inValues) {
    StringBuilder condition = new StringBuilder(" IN (");
    SqlUtils.appendPlaceholders(condition, inValues.length).append(')');
    return new PropertyCondition(this, condition.toString(), inValues);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:Property.java


示例11: notIn

import org.greenrobot.greendao.query.WhereCondition; //导入依赖的package包/类
/** Creates an "NOT IN (..., ..., ...)" condition  for this property. */
public WhereCondition notIn(Object... notInValues) {
    StringBuilder condition = new StringBuilder(" NOT IN (");
    SqlUtils.appendPlaceholders(condition, notInValues.length).append(')');
    return new PropertyCondition(this, condition.toString(), notInValues);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:Property.java


示例12: gt

import org.greenrobot.greendao.query.WhereCondition; //导入依赖的package包/类
/** Creates an "greater than ('>')" condition  for this property. */
public WhereCondition gt(Object value) {
    return new PropertyCondition(this, ">?", value);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:Property.java


示例13: lt

import org.greenrobot.greendao.query.WhereCondition; //导入依赖的package包/类
/** Creates an "less than ('<')" condition  for this property. */
public WhereCondition lt(Object value) {
    return new PropertyCondition(this, "<?", value);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:Property.java


示例14: ge

import org.greenrobot.greendao.query.WhereCondition; //导入依赖的package包/类
/** Creates an "greater or equal ('>=')" condition  for this property. */
public WhereCondition ge(Object value) {
    return new PropertyCondition(this, ">=?", value);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:Property.java


示例15: le

import org.greenrobot.greendao.query.WhereCondition; //导入依赖的package包/类
/** Creates an "less or equal ('<=')" condition  for this property. */
public WhereCondition le(Object value) {
    return new PropertyCondition(this, "<=?", value);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:Property.java


示例16: isNull

import org.greenrobot.greendao.query.WhereCondition; //导入依赖的package包/类
/** Creates an "IS NULL" condition  for this property. */
public WhereCondition isNull() {
    return new PropertyCondition(this, " IS NULL");
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:Property.java


示例17: isNotNull

import org.greenrobot.greendao.query.WhereCondition; //导入依赖的package包/类
/** Creates an "IS NOT NULL" condition  for this property. */
public WhereCondition isNotNull() {
    return new PropertyCondition(this, " IS NOT NULL");
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:Property.java


示例18: getByCloudMusic

import org.greenrobot.greendao.query.WhereCondition; //导入依赖的package包/类
public PlayMusic getByCloudMusic(PlayMusic music) {
    WhereCondition condition = dao.queryBuilder().and(Properties.Title.eq(music.getTitle()), Properties.Singer.eq(music.getSinger()));
    return dao.queryBuilder().whereOr(Properties.Musicid.eq(music.getId()), condition).limit(1).unique();
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:5,代码来源:LocalAudioDataSource.java


示例19: query

import org.greenrobot.greendao.query.WhereCondition; //导入依赖的package包/类
public <T> List<T> query(Class<T> clazz, WhereCondition condition) {

        QueryBuilder<T> builder = manager.getDaoSession().queryBuilder(clazz);
        builder.where(condition);
        return builder.list();

    }
 
开发者ID:weixianshishen,项目名称:BeautifulGirls,代码行数:8,代码来源:DbManager.java



注:本文中的org.greenrobot.greendao.query.WhereCondition类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GroupManager类代码示例发布时间:2022-05-23
下一篇:
Java MetalComboBoxButton类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap