Skip to content
This repository was archived by the owner on Jun 27, 2020. It is now read-only.

Commit 773cdc7

Browse files
author
Evgeniy Kanivets
committed
Added selecting only needed records from DB according to period
1 parent df00f65 commit 773cdc7

File tree

1 file changed

+5
-1
lines changed
  • app/src/main/java/com/blogspot/e_kanivets/moneytracker/helper

1 file changed

+5
-1
lines changed

app/src/main/java/com/blogspot/e_kanivets/moneytracker/helper/MTHelper.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,12 @@ public void initialize() {
7171

7272
cursor.close();
7373

74+
//Form args to select only needed records according to period
75+
String[] args = new String[] {Long.toString(period.getFirst().getTime()),
76+
Long.toString(period.getLast().getTime())};
77+
7478
//Read records table from db
75-
cursor = db.query(Constants.TABLE_RECORDS, null, null, null, null, null, null);
79+
cursor = db.query(Constants.TABLE_RECORDS, null, "time BETWEEN ? AND ?", args, null, null, null);
7680
records = new ArrayList<Record>();
7781

7882
if(cursor.moveToFirst()) {

0 commit comments

Comments
 (0)