From f53a037d7f59b3ecb0b3015968bae17739c03f6d Mon Sep 17 00:00:00 2001 From: cpfeiffer Date: Sun, 12 Jul 2015 21:50:09 +0200 Subject: [PATCH] Use query instead of rawQuery --- .../gadgetbridge/database/ActivityDatabaseHandler.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/database/ActivityDatabaseHandler.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/database/ActivityDatabaseHandler.java index e3ccaace1..fe52d735a 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/database/ActivityDatabaseHandler.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/database/ActivityDatabaseHandler.java @@ -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 } ArrayList GBActivitySampleList = new ArrayList(); - String selectQuery = "SELECT * FROM " + TABLE_GBACTIVITYSAMPLES - + " where (provider=" + provider + " and timestamp>=" + timestamp_from + " and timestamp<=" + timestamp_to + ") order by timestamp"; - + final String where = "(provider=" + provider + " and timestamp>=" + timestamp_from + " and timestamp<=" + timestamp_to + ")"; + final String order = "timestamp"; 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()) { do {