1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-05 09:47:01 +01:00

Use query instead of rawQuery

This commit is contained in:
cpfeiffer 2015-07-12 21:50:09 +02:00
parent 623e4724c2
commit f53a037d7f

View File

@ -115,11 +115,10 @@ public class ActivityDatabaseHandler extends SQLiteOpenHelper {
timestamp_to = Integer.MAX_VALUE; // dont know what happens when I use more than max of a signed int timestamp_to = Integer.MAX_VALUE; // dont know what happens when I use more than max of a signed int
} }
ArrayList<GBActivitySample> GBActivitySampleList = new ArrayList<GBActivitySample>(); ArrayList<GBActivitySample> GBActivitySampleList = new ArrayList<GBActivitySample>();
String selectQuery = "SELECT * FROM " + TABLE_GBACTIVITYSAMPLES final String where = "(provider=" + provider + " and timestamp>=" + timestamp_from + " and timestamp<=" + timestamp_to + ")";
+ " where (provider=" + provider + " and timestamp>=" + timestamp_from + " and timestamp<=" + timestamp_to + ") order by timestamp"; final String order = "timestamp";
try (SQLiteDatabase db = this.getReadableDatabase()) { try (SQLiteDatabase db = this.getReadableDatabase()) {
Cursor cursor = db.rawQuery(selectQuery, null); Cursor cursor = db.query(TABLE_GBACTIVITYSAMPLES, null, where, null, null, null, order);
if (cursor.moveToFirst()) { if (cursor.moveToFirst()) {
do { do {