+ // Prepare a string that contains the comma-separated list of IDs not to get.
+ String doNotGetIdsString = "";
+ // Extract the array to `doNotGetIdsString`.
+ for (long databaseIdLong : exceptIdLongArray) {
+ // If this is the first number, only add the number.
+ if (doNotGetIdsString.isEmpty()) {
+ doNotGetIdsString = String.valueOf(databaseIdLong);
+ } else { // If there already is a number in the string, place a `,` before the number.
+ doNotGetIdsString = doNotGetIdsString + "," + databaseIdLong;
+ }
+ }
+
+ // Prepare the SQL statement to select all items except those with the specified IDs.
+ final String GET_All_BOOKMARKS_EXCEPT_SPECIFIED = "Select * FROM " + BOOKMARKS_TABLE +
+ " WHERE " + _ID + " NOT IN (" + doNotGetIdsString + ")";
+
+ // Return the results as a Cursor. The second argument is `null` because there are no selectionArgs.
+ // We can't close the Cursor because we need to use it in the parent activity.
+ return bookmarksDatabase.rawQuery(GET_All_BOOKMARKS_EXCEPT_SPECIFIED, null);
+ }
+
+ public String getBookmarkURL(int databaseId) {
+ // Get a readable database handle.
+ SQLiteDatabase bookmarksDatabase = this.getReadableDatabase();
+
+ // Prepare the SQL statement to get the row for the selected databaseId.
+ final String GET_BOOKMARK_URL = "Select * FROM " + BOOKMARKS_TABLE +
+ " WHERE " + _ID + " = " + databaseId;