Java Code Examples for com.j256.ormlite.stmt.Where#between()
The following examples show how to use
com.j256.ormlite.stmt.Where#between() .
These examples are extracted from open source projects.
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 Project: AndroidAPS File: DatabaseHelper.java License: GNU Affero General Public License v3.0 | 6 votes |
public List<TempTarget> getTemptargetsDataFromTime(long from, long to, boolean ascending) { try { Dao<TempTarget, Long> daoTempTargets = getDaoTempTargets(); List<TempTarget> tempTargets; QueryBuilder<TempTarget, Long> queryBuilder = daoTempTargets.queryBuilder(); queryBuilder.orderBy("date", ascending); Where where = queryBuilder.where(); where.between("date", from, to); PreparedQuery<TempTarget> preparedQuery = queryBuilder.prepare(); tempTargets = daoTempTargets.query(preparedQuery); return tempTargets; } catch (SQLException e) { log.error("Unhandled exception", e); } return new ArrayList<TempTarget>(); }
Example 2
Source Project: AndroidAPS File: DatabaseHelper.java License: GNU Affero General Public License v3.0 | 6 votes |
public List<ProfileSwitch> getProfileSwitchEventsFromTime(long from, long to, boolean ascending) { try { Dao<ProfileSwitch, Long> daoProfileSwitch = getDaoProfileSwitch(); List<ProfileSwitch> profileSwitches; QueryBuilder<ProfileSwitch, Long> queryBuilder = daoProfileSwitch.queryBuilder(); queryBuilder.orderBy("date", ascending); queryBuilder.limit(100L); Where where = queryBuilder.where(); where.between("date", from, to); PreparedQuery<ProfileSwitch> preparedQuery = queryBuilder.prepare(); profileSwitches = daoProfileSwitch.query(preparedQuery); return profileSwitches; } catch (SQLException e) { log.error("Unhandled exception", e); } return new ArrayList<>(); }
Example 3
Source Project: AndroidAPS File: TreatmentService.java License: GNU Affero General Public License v3.0 | 6 votes |
public List<Treatment> getTreatmentDataFromTime(long from, long to, boolean ascending) { try { Dao<Treatment, Long> daoTreatments = getDao(); List<Treatment> treatments; QueryBuilder<Treatment, Long> queryBuilder = daoTreatments.queryBuilder(); queryBuilder.orderBy("date", ascending); Where where = queryBuilder.where(); where.between("date", from, to); PreparedQuery<Treatment> preparedQuery = queryBuilder.prepare(); treatments = daoTreatments.query(preparedQuery); return treatments; } catch (SQLException e) { log.error("Unhandled exception", e); } return new ArrayList<>(); }
Example 4
Source Project: zulip-android File: NarrowFilterByDate.java License: Apache License 2.0 | 6 votes |
@Override public Where<Message, Object> modWhere(Where<Message, Object> where) throws SQLException { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); Date fromDate = calendar.getTime(); calendar.add(Calendar.DAY_OF_MONTH, 1); Date toDate = calendar.getTime(); where.between(Message.TIMESTAMP_FIELD, fromDate, toDate); return where; }
Example 5
Source Project: AndroidAPS File: DatabaseHelper.java License: GNU Affero General Public License v3.0 | 5 votes |
public List<TemporaryBasal> getTemporaryBasalsDataFromTime(long from, long to, boolean ascending) { try { List<TemporaryBasal> tempbasals; QueryBuilder<TemporaryBasal, Long> queryBuilder = getDaoTemporaryBasal().queryBuilder(); queryBuilder.orderBy("date", ascending); Where where = queryBuilder.where(); where.between("date", from, to); PreparedQuery<TemporaryBasal> preparedQuery = queryBuilder.prepare(); tempbasals = getDaoTemporaryBasal().query(preparedQuery); return tempbasals; } catch (SQLException e) { log.error("Unhandled exception", e); } return new ArrayList<TemporaryBasal>(); }
Example 6
Source Project: mage-android File: DateTimeFilter.java License: Apache License 2.0 | 5 votes |
@Override public void and(Where<? extends Temporal, Long> where) throws SQLException { where.and(); if (start != null && end != null) { where.between(columnName, start, end); } else if (start != null) { where.ge(columnName, start); } else { where.lt(columnName, end); } }