com.j256.ormlite.stmt.Where.lt()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(198)

本文整理了Java中com.j256.ormlite.stmt.Where.lt()方法的一些代码示例,展示了Where.lt()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Where.lt()方法的具体详情如下:
包路径:com.j256.ormlite.stmt.Where
类名称:Where
方法名:lt

Where.lt介绍

[英]Add a '<' clause so the column must be less-than the value.
[中]添加“<”子句,使该列必须小于该值。

代码示例

代码示例来源:origin: mycontroller-org/mycontroller

protected void updatePurgeCondition(Where<?, Object> where, String key, Object value,
    OPERATOR operator) throws SQLException {
  switch (operator) {
    case EQ:
      where.eq(key, value);
      break;
    case GT:
      where.gt(key, value);
      break;
    case LT:
      where.lt(key, value);
      break;
    case GE:
      where.ge(key, value);
      break;
    case LE:
      where.le(key, value);
      break;
    case NE:
      where.ne(key, value);
      break;
    default:
      where.eq(key, value);
      break;
  }
}

代码示例来源:origin: annmuor/jnode

case "lt":
case "<":
  wh.lt(args[i].toString(),  new SelectArg(args[i + 2]));
  break;
case "le":

代码示例来源:origin: j256/ormlite-core

@Test
public void testLt() throws Exception {
  Where<Foo, String> where = new Where<Foo, String>(createTableInfo(), null, databaseType);
  int val = 112;
  where.lt(Foo.VAL_COLUMN_NAME, val);
  testOperation(where, Foo.VAL_COLUMN_NAME, "<", val);
}

代码示例来源:origin: QuickBlox/q-municate-android

public List<Message> getMessagesByDialogIdAndDate(String dialogId, long createdDate, boolean moreDate){
  List<Message> messagesList = new ArrayList<>();
  try {
    QueryBuilder<Message, Long> messageQueryBuilder = dao.queryBuilder();
    Where<Message, Long> where = messageQueryBuilder.where();
    where.and(where.ne(Message.Column.STATE, State.TEMP_LOCAL),
        where.ne(Message.Column.STATE, State.TEMP_LOCAL_UNREAD),
        moreDate
            ? where.gt(Message.Column.CREATED_DATE, createdDate)
            : where.lt(Message.Column.CREATED_DATE, createdDate));
    QueryBuilder<DialogOccupant, Long> dialogOccupantQueryBuilder = dialogOccupantDao.queryBuilder();
    QueryBuilder<Dialog, Long> dialogQueryBuilder = dialogDao.queryBuilder();
    dialogQueryBuilder.where().eq(Dialog.Column.ID, dialogId);
    dialogOccupantQueryBuilder.join(dialogQueryBuilder);
    messageQueryBuilder.join(dialogOccupantQueryBuilder);
    PreparedQuery<Message> preparedQuery = messageQueryBuilder.prepare();
    messagesList = dao.query(preparedQuery);
  } catch (SQLException e) {
    ErrorUtils.logError(e);
  }
  return messagesList;
}

代码示例来源:origin: QuickBlox/q-municate-android

public List<DialogNotification> getDialogNotificationsByDialogIdAndDate(String dialogId, long createdDate, boolean moreDate) {
  List<DialogNotification> dialogNotificationsList = new ArrayList<>();
  try {
    QueryBuilder<DialogNotification, Long> messageQueryBuilder = dao.queryBuilder();
    Where<DialogNotification, Long> where = messageQueryBuilder.where();
    where.and(where.ne(DialogNotification.Column.STATE, State.TEMP_LOCAL),
        where.ne(DialogNotification.Column.STATE, State.TEMP_LOCAL_UNREAD),
        moreDate
            ? where.gt(DialogNotification.Column.CREATED_DATE, createdDate)
            : where.lt(DialogNotification.Column.CREATED_DATE, createdDate));
    QueryBuilder<DialogOccupant, Long> dialogOccupantQueryBuilder = dialogOccupantDao
        .queryBuilder();
    QueryBuilder<Dialog, Long> dialogQueryBuilder = dialogDao.queryBuilder();
    dialogQueryBuilder.where().eq(Dialog.Column.ID, dialogId);
    dialogOccupantQueryBuilder.join(dialogQueryBuilder);
    messageQueryBuilder.join(dialogOccupantQueryBuilder);
    PreparedQuery<DialogNotification> preparedQuery = messageQueryBuilder.prepare();
    dialogNotificationsList = dao.query(preparedQuery);
  } catch (SQLException e) {
    ErrorUtils.logError(e);
  }
  return dialogNotificationsList;
}

代码示例来源:origin: ngageoint/geopackage-android

qb.where().lt(TileMatrixSet.COLUMN_MIN_X, 0.0).and()
    .lt(TileMatrixSet.COLUMN_MIN_Y, 0.0);
PreparedQuery<TileMatrixSet> preparedQuery = qb.prepare();
List<TileMatrixSet> queryTileMatrixSet = dao
ub.updateColumnValue(TileMatrixSet.COLUMN_MIN_X, updatedMin);
ub.updateColumnValue(TileMatrixSet.COLUMN_MIN_Y, updatedMin);
ub.where().lt(TileMatrixSet.COLUMN_MIN_X, 0.0).and()
    .lt(TileMatrixSet.COLUMN_MIN_Y, 0.0);
PreparedUpdate<TileMatrixSet> update = ub.prepare();
int updated = dao.update(update);

代码示例来源:origin: org.mycontroller.standalone/mycontroller-core

where.gt(MetricsDoubleTypeDevice.KEY_AVG, McUtils.getDouble(delimiter.substring(1)));
} else if (delimiter.startsWith("<")) {
  where.lt(MetricsDoubleTypeDevice.KEY_AVG, McUtils.getDouble(delimiter.substring(1)));
} else if (delimiter.startsWith("=")) {
  where.eq(MetricsDoubleTypeDevice.KEY_AVG, McUtils.getDouble(delimiter.substring(1)));

代码示例来源:origin: QuickBlox/q-municate-android

public List<DialogNotification> getDialogNotificationsByDialogIdAndDate(String dialogId, long createdDate, boolean moreDate, long limit) {
  List<DialogNotification> dialogNotificationsList = new ArrayList<>();
  try {
    QueryBuilder<DialogNotification, Long> messageQueryBuilder = dao.queryBuilder();
    Where<DialogNotification, Long> where = messageQueryBuilder.where();
    where.and(where.ne(DialogNotification.Column.STATE, State.TEMP_LOCAL),
        where.ne(DialogNotification.Column.STATE, State.TEMP_LOCAL_UNREAD),
        moreDate
            ? where.gt(DialogNotification.Column.CREATED_DATE, createdDate)
            : where.lt(DialogNotification.Column.CREATED_DATE, createdDate));
    QueryBuilder<DialogOccupant, Long> dialogOccupantQueryBuilder = dialogOccupantDao
        .queryBuilder();
    QueryBuilder<Dialog, Long> dialogQueryBuilder = dialogDao.queryBuilder();
    dialogQueryBuilder.where().eq(Dialog.Column.ID, dialogId);
    dialogOccupantQueryBuilder.join(dialogQueryBuilder);
    messageQueryBuilder
        .join(dialogOccupantQueryBuilder)
        .orderBy(DialogNotification.Column.CREATED_DATE, false)
        .limit(limit);
    PreparedQuery<DialogNotification> preparedQuery = messageQueryBuilder.prepare();
    dialogNotificationsList = dao.query(preparedQuery);
  } catch (SQLException e) {
    ErrorUtils.logError(e);
  }
  return dialogNotificationsList;
}

代码示例来源:origin: QuickBlox/q-municate-android

public List<Message> getMessagesByDialogIdAndDate(String dialogId, long createdDate, boolean moreDate, long limit){
  List<Message> messagesList = new ArrayList<>();
  try {
    QueryBuilder<Message, Long> messageQueryBuilder = dao.queryBuilder();
    Where<Message, Long> where = messageQueryBuilder.where();
    where.and(where.ne(Message.Column.STATE, State.TEMP_LOCAL),
        where.ne(Message.Column.STATE, State.TEMP_LOCAL_UNREAD),
        moreDate
            ? where.gt(Message.Column.CREATED_DATE, createdDate)
            : where.lt(Message.Column.CREATED_DATE, createdDate));
    QueryBuilder<DialogOccupant, Long> dialogOccupantQueryBuilder = dialogOccupantDao.queryBuilder();
    QueryBuilder<Dialog, Long> dialogQueryBuilder = dialogDao.queryBuilder();
    dialogQueryBuilder.where().eq(Dialog.Column.ID, dialogId);
    dialogOccupantQueryBuilder.join(dialogQueryBuilder);
    messageQueryBuilder
        .join(dialogOccupantQueryBuilder)
        .orderBy(Message.Column.CREATED_DATE, false)
        .limit(limit);
    PreparedQuery<Message> preparedQuery = messageQueryBuilder.prepare();
    messagesList = dao.query(preparedQuery);
  } catch (SQLException e) {
    ErrorUtils.logError(e);
  }
  return messagesList;
}

代码示例来源:origin: com.j256.ormlite/ormlite-jdbc

/**
 * This is special because comparing floats may not work as expected.
 */
@Test
public void testAllTypesFloat() throws Exception {
  Dao<AllTypes, Integer> allDao = createDao(AllTypes.class, true);
  AllTypes allTypes = new AllTypes();
  float floatVal = 123.13F;
  float floatLowVal = floatVal * 0.9F;
  float floatHighVal = floatVal * 1.1F;
  allTypes.floatField = floatVal;
  assertEquals(1, allDao.create(allTypes));
  List<AllTypes> allTypesList = allDao.queryForAll();
  assertEquals(1, allTypesList.size());
  assertTrue(allDao.objectsEqual(allTypes, allTypesList.get(0)));
  assertEquals(1, allDao.refresh(allTypes));
  // queries on all fields
  QueryBuilder<AllTypes, Integer> qb = allDao.queryBuilder();
  // float comparisons are not exactly right so we switch to a low -> high query instead
  if (!checkQueryResult(allDao, qb, allTypes, AllTypes.FLOAT_FIELD_NAME, floatVal, false)) {
    qb.where().gt(AllTypes.FLOAT_FIELD_NAME, floatLowVal).and().lt(AllTypes.FLOAT_FIELD_NAME, floatHighVal);
    List<AllTypes> results = allDao.query(qb.prepare());
    assertEquals(1, results.size());
    assertTrue(allDao.objectsEqual(allTypes, results.get(0)));
  }
}

代码示例来源:origin: com.j256.ormlite/ormlite-jdbc

assertEquals(0, results.size());
qb.where().lt(Foo.VAL_COLUMN_NAME, foo1.val);
results = fooDao.query(qb.prepare());
assertEquals(0, results.size());
qb.where().lt(Foo.VAL_COLUMN_NAME, foo1.val + 1);
results = fooDao.query(qb.prepare());
assertEquals(1, results.size());

代码示例来源:origin: org.mycontroller.standalone/mycontroller-core

where.and().lt(ResourcesLogs.KEY_TIMESTAMP, resourcesLogs.getTimestamp());

代码示例来源:origin: mycontroller-org/mycontroller

where.and().lt(ResourcesLogs.KEY_TIMESTAMP, resourcesLogs.getTimestamp());

代码示例来源:origin: com.j256.ormlite/ormlite-jdbc

bqb.where().eq(Basic.ID_FIELD, arg1);
PreparedQuery<Foo> preparedQuery =
    fooDao.queryBuilder().where().in(Foo.STUFF_FIELD_NAME, bqb).and().lt(Foo.ID_FIELD_NAME, arg2).prepare();
arg1.setValue(string1);

相关文章