OSDN Git Service

MtpDatabase: Fix sqlite3 pattern matching for MTP directory deletes
authorMike Lockwood <lockwood@google.com>
Tue, 26 Jun 2012 23:31:41 +0000 (16:31 -0700)
committerMike Lockwood <lockwood@google.com>
Tue, 26 Jun 2012 23:33:05 +0000 (16:33 -0700)
Bug: 6684451

Change-Id: I90204550ccfcd1b7a5b1973bed2a88e934aae053
Signed-off-by: Mike Lockwood <lockwood@google.com>
media/java/android/mtp/MtpDatabase.java

index c365e4c..7532d79 100755 (executable)
@@ -933,10 +933,10 @@ public class MtpDatabase {
                 // recursive case - delete all children first
                 Uri uri = Files.getMtpObjectsUri(mVolumeName);
                 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 + "/"});
+                    // the 'like' makes it use the index, the 'lower()' makes it correct
+                    // when the path contains sqlite wildcard characters
+                    "_data LIKE ?1 AND lower(substr(_data,1,?2))=lower(?3)",
+                    new String[] { path + "/%",Integer.toString(path.length() + 1), path + "/"});
             }
 
             Uri uri = Files.getMtpObjectsUri(mVolumeName, handle);