+ /* just for log
+ if (c!=null) {
+ c.close();
+ }
+ */
+ break;
+ case DIRECTORY:
+ // deletion of folder is recursive
+ /*
+ Uri folderUri = ContentUris.withAppendedId(ProviderTableMeta.CONTENT_URI_FILE, Long.parseLong(uri.getPathSegments().get(1)));
+ Cursor folder = query(db, folderUri, null, null, null, null);
+ String folderName = "(unknown)";
+ if (folder != null && folder.moveToFirst()) {
+ folderName = folder.getString(folder.getColumnIndex(ProviderTableMeta.FILE_PATH));
+ }
+ */
+ Cursor children = query(uri, null, null, null, null);
+ if (children != null && children.moveToFirst()) {
+ long childId;
+ boolean isDir;
+ String remotePath;
+ while (!children.isAfterLast()) {
+ childId = children.getLong(children.getColumnIndex(ProviderTableMeta._ID));
+ isDir = "DIR".equals(children.getString(children.getColumnIndex(ProviderTableMeta.FILE_CONTENT_TYPE)));
+ remotePath = children.getString(children.getColumnIndex(ProviderTableMeta.FILE_PATH));
+ if (isDir) {
+ count += delete(db, ContentUris.withAppendedId(ProviderTableMeta.CONTENT_URI_DIR, childId), null, null);
+ } else {
+ count += delete(db, ContentUris.withAppendedId(ProviderTableMeta.CONTENT_URI_FILE, childId), null, null);
+ }
+ children.moveToNext();
+ }
+ children.close();
+ } /*else {
+ Log_OC.d(TAG, "No child to remove in DIRECTORY " + folderName);
+ }
+ Log_OC.d(TAG, "Removing DIRECTORY " + folderName + " (or maybe not) ");
+ */
+ count += db.delete(ProviderTableMeta.DB_NAME,
+ ProviderTableMeta._ID
+ + "="
+ + uri.getPathSegments().get(1)
+ + (!TextUtils.isEmpty(where) ? " AND (" + where
+ + ")" : ""), whereArgs);
+ /* Just for log
+ if (folder != null) {
+ folder.close();
+ }*/