Bug 701913 - Fix query to check bookmark URL in Honeycomb/ICS (r=blassey, a=mfinkle)

This commit is contained in:
Lucas Rocha 2011-12-13 13:44:54 +00:00
parent 974aaa4bfd
commit 032142fb4c

View File

@ -144,12 +144,29 @@ public class AndroidBrowserDB implements BrowserDB.BrowserDBIface {
return new AndroidDBCursor(c); return new AndroidDBCursor(c);
} }
public Cursor isBookmarkQueryPre11(ContentResolver cr, String uri) {
return cr.query(Browser.BOOKMARKS_URI,
new String[] { BookmarkColumns.URL },
Browser.BookmarkColumns.URL + " = ? and " + Browser.BookmarkColumns.BOOKMARK + " = ?",
new String[] { uri, "1" },
Browser.BookmarkColumns.URL);
}
public Cursor isBookmarkQueryPost11(ContentResolver cr, String uri) {
return cr.query(BOOKMARKS_CONTENT_URI_POST_11,
new String[] { BookmarkColumns.URL },
Browser.BookmarkColumns.URL + " = ?",
new String[] { uri },
Browser.BookmarkColumns.URL);
}
public boolean isBookmark(ContentResolver cr, String uri) { public boolean isBookmark(ContentResolver cr, String uri) {
Cursor cursor = cr.query(Browser.BOOKMARKS_URI, Cursor cursor;
new String[] { BookmarkColumns.URL },
Browser.BookmarkColumns.URL + " = ? and " + Browser.BookmarkColumns.BOOKMARK + " = ?", if (Build.VERSION.SDK_INT >= 11)
new String[] { uri, "1" }, cursor = isBookmarkQueryPost11(cr, uri);
Browser.BookmarkColumns.URL); else
cursor = isBookmarkQueryPre11(cr, uri);
int count = cursor.getCount(); int count = cursor.getCount();
cursor.close(); cursor.close();