am 101fb9fe: Merge "Handle _ and % in paths" into jb-dev
* commit '101fb9fe2b5001e8122e2965c115688c1f42bd63': Handle _ and % in paths
This commit is contained in:
@@ -1444,7 +1444,9 @@ public class MediaScanner
|
||||
String where;
|
||||
String[] selectionArgs;
|
||||
if (mCaseInsensitivePaths) {
|
||||
where = Files.FileColumns.DATA + " LIKE ?";
|
||||
// the 'like' makes it use the index, the 'lower()' makes it correct
|
||||
// when the path contains sqlite wildcard characters
|
||||
where = "_data LIKE ?1 AND lower(_data)=lower(?1)";
|
||||
selectionArgs = new String[] { path };
|
||||
} else {
|
||||
where = Files.FileColumns.DATA + "=?";
|
||||
|
||||
@@ -932,8 +932,11 @@ public class MtpDatabase {
|
||||
if (format == MtpConstants.FORMAT_ASSOCIATION) {
|
||||
// recursive case - delete all children first
|
||||
Uri uri = Files.getMtpObjectsUri(mVolumeName);
|
||||
int count = mMediaProvider.delete(uri, "_data LIKE ?",
|
||||
new String[] { path + "/%"});
|
||||
int count = mMediaProvider.delete(uri,
|
||||
// the 'like' makes it use the index, the 'lower()' makes it correct
|
||||
// when the path contains sqlite wildcard characters
|
||||
"_data LIKE ? AND lower(substr(_data,?))=lower(?)",
|
||||
new String[] { path + "/%", "" + path.length() + 1, path + "/"});
|
||||
}
|
||||
|
||||
Uri uri = Files.getMtpObjectsUri(mVolumeName, handle);
|
||||
|
||||
Reference in New Issue
Block a user