Skip to content

Commit

Permalink
fix db usage
Browse files Browse the repository at this point in the history
  • Loading branch information
thasmin committed Apr 28, 2012
1 parent 90e3234 commit a78fd08
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/com/axelby/gpodder/Provider.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public Cursor query(Uri uri, String[] projection, String selection,
"WHERE url NOT IN (SELECT url FROM pending_remove)", null);
else
c = db.query("subscriptions", new String[] { "url" }, "url = ?", new String[] { uri.getPath() }, null, null, null);
db.close();
return c;
}

Expand All @@ -70,7 +69,7 @@ public Uri insert(Uri uri, ContentValues values) {
c.moveToFirst();
if (c.getLong(0) == 0)
db.insert("pending_add", null, values);
db.close();
c.close();
return Uri.withAppendedPath(URI, url);
}

Expand All @@ -96,8 +95,8 @@ public int delete(Uri uri, String selection, String[] selectionArgs) {
values.put(URL, url);
db.insert("pending_remove", null, values);
}
c.close();
}
db.close();
return selectionArgs.length;
} else {
int count = db.delete("pending_add", "1", null);
Expand All @@ -108,7 +107,6 @@ public int delete(Uri uri, String selection, String[] selectionArgs) {
db.insert("pending_remove", null, makeUrlValues(c.getString(0)));
}
c.close();
db.close();
return count;
}
}
Expand Down

0 comments on commit a78fd08

Please sign in to comment.