mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 06:35:42 +00:00
Bug 904081 - Avoid exceeding query var limit in getFaviconsForUrls() (r=margaret)
This commit is contained in:
parent
e72d114acd
commit
79c105da2d
@ -22,6 +22,7 @@ import android.content.ContentValues;
|
||||
import android.database.ContentObserver;
|
||||
import android.database.Cursor;
|
||||
import android.database.CursorWrapper;
|
||||
import android.database.DatabaseUtils;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.net.Uri;
|
||||
@ -752,23 +753,23 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
@Override
|
||||
public Cursor getFaviconsForUrls(ContentResolver cr, List<String> urls) {
|
||||
StringBuilder selection = new StringBuilder();
|
||||
String[] selectionArgs = new String[urls.size()];
|
||||
selection.append(Favicons.URL + " IN (");
|
||||
|
||||
for (int i = 0; i < urls.size(); i++) {
|
||||
final String url = urls.get(i);
|
||||
|
||||
if (i > 0)
|
||||
selection.append(" OR ");
|
||||
selection.append(", ");
|
||||
|
||||
selection.append(Favicons.URL + " = ?");
|
||||
selectionArgs[i] = url;
|
||||
DatabaseUtils.appendEscapedSQLString(selection, url);
|
||||
}
|
||||
|
||||
selection.append(")");
|
||||
|
||||
return cr.query(mCombinedUriWithProfile,
|
||||
new String[] { Combined.URL, Combined.FAVICON },
|
||||
selection.toString(),
|
||||
selectionArgs,
|
||||
null);
|
||||
null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user