Merge pull request #2617 from Philoul/DatabaseHelper_Missing_Function

Add missing function in DatabaseHelper
This commit is contained in:
Milos Kozak 2020-05-04 11:52:50 +02:00 committed by GitHub
commit 948bb8dc33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1250,6 +1250,22 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
return new ArrayList<ExtendedBolus>(); return new ArrayList<ExtendedBolus>();
} }
public List<ExtendedBolus> getExtendedBolusDataFromTime(long from, long to, boolean ascending) {
try {
List<ExtendedBolus> extendedBoluses;
QueryBuilder<ExtendedBolus, Long> queryBuilder = getDaoExtendedBolus().queryBuilder();
queryBuilder.orderBy("date", ascending);
Where where = queryBuilder.where();
where.between("date", from, to);
PreparedQuery<ExtendedBolus> preparedQuery = queryBuilder.prepare();
extendedBoluses = getDaoExtendedBolus().query(preparedQuery);
return extendedBoluses;
} catch (SQLException e) {
log.error("Unhandled exception", e);
}
return new ArrayList<ExtendedBolus>();
}
public void deleteExtendedBolusById(String _id) { public void deleteExtendedBolusById(String _id) {
ExtendedBolus stored = findExtendedBolusById(_id); ExtendedBolus stored = findExtendedBolusById(_id);
if (stored != null) { if (stored != null) {