36 {
37 String[] column = { HistoryDB.QUICK_CONNECT_TABLE_COL_ITEM };
38
39 SQLiteDatabase db = getReadableDatabase();
40 String selection =
41 (filter.length() > 0)
42 ? (HistoryDB.QUICK_CONNECT_TABLE_COL_ITEM + " LIKE '%" + filter + "%'")
43 : null;
44 Cursor cursor = db.query(HistoryDB.QUICK_CONNECT_TABLE_NAME, column, selection, null, null,
45 null, HistoryDB.QUICK_CONNECT_TABLE_COL_TIMESTAMP);
46
47 ArrayList<BookmarkBase> result = new ArrayList<>(cursor.getCount());
48 if (cursor.moveToFirst())
49 {
50 do
51 {
52 String hostname =
53 cursor.getString(cursor.getColumnIndex(HistoryDB.QUICK_CONNECT_TABLE_COL_ITEM));
54 QuickConnectBookmark bookmark = new QuickConnectBookmark();
55 bookmark.setLabel(hostname);
56 bookmark.setHostname(hostname);
57 result.add(bookmark);
58 } while (cursor.moveToNext());
59 }
60 cursor.close();
61 return result;
62 }