X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/c39e851f5eada08c93d3a57d41054ea112b4bfcf..d5625e6cccd85dfb0f9e66a2da8f844341c96e2b:/src/com/owncloud/android/providers/FileContentProvider.java diff --git a/src/com/owncloud/android/providers/FileContentProvider.java b/src/com/owncloud/android/providers/FileContentProvider.java index c84d66b0..9792f3e9 100644 --- a/src/com/owncloud/android/providers/FileContentProvider.java +++ b/src/com/owncloud/android/providers/FileContentProvider.java @@ -24,8 +24,8 @@ import java.util.HashMap; import com.owncloud.android.R; import com.owncloud.android.db.ProviderMeta; import com.owncloud.android.db.ProviderMeta.ProviderTableMeta; +import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.lib.resources.shares.ShareType; -import com.owncloud.android.utils.Log_OC; @@ -93,6 +93,12 @@ public class FileContentProvider extends ContentProvider { ProviderTableMeta.FILE_SHARE_BY_LINK); mFileProjectionMap.put(ProviderTableMeta.FILE_PUBLIC_LINK, ProviderTableMeta.FILE_PUBLIC_LINK); + mFileProjectionMap.put(ProviderTableMeta.FILE_PERMISSIONS, + ProviderTableMeta.FILE_PERMISSIONS); + mFileProjectionMap.put(ProviderTableMeta.FILE_REMOTE_ID, + ProviderTableMeta.FILE_REMOTE_ID); + mFileProjectionMap.put(ProviderTableMeta.FILE_UPDATE_THUMBNAIL, + ProviderTableMeta.FILE_UPDATE_THUMBNAIL); } private static final int SINGLE_FILE = 1; @@ -416,7 +422,6 @@ public class FileContentProvider extends ContentProvider { // DB case_sensitive db.execSQL("PRAGMA case_sensitive_like = true"); Cursor c = sqlQuery.query(db, projection, selection, selectionArgs, null, null, order); - Log_OC.d(TAG, "setting notification URI: " + uri); c.setNotificationUri(getContext().getContentResolver(), uri); return c; } @@ -554,7 +559,10 @@ public class FileContentProvider extends ContentProvider { + ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA + " INTEGER, " + ProviderTableMeta.FILE_ETAG + " TEXT, " + ProviderTableMeta.FILE_SHARE_BY_LINK + " INTEGER, " - + ProviderTableMeta.FILE_PUBLIC_LINK + " TEXT );" + + ProviderTableMeta.FILE_PUBLIC_LINK + " TEXT, " + + ProviderTableMeta.FILE_PERMISSIONS + " TEXT null," + + ProviderTableMeta.FILE_REMOTE_ID + " TEXT null," + + ProviderTableMeta.FILE_UPDATE_THUMBNAIL + " INTEGER);" //boolean ); // Create table ocshares @@ -643,7 +651,7 @@ public class FileContentProvider extends ContentProvider { } if (!upgraded) Log_OC.i("SQL", "OUT of the ADD in onUpgrade; oldVersion == " + oldVersion + ", newVersion == " + newVersion); - + if (oldVersion < 6 && newVersion >= 6) { Log_OC.i("SQL", "Entering in the #5 ADD in onUpgrade"); db.beginTransaction(); @@ -655,7 +663,7 @@ public class FileContentProvider extends ContentProvider { db .execSQL("ALTER TABLE " + ProviderTableMeta.FILE_TABLE_NAME + " ADD COLUMN " + ProviderTableMeta.FILE_PUBLIC_LINK + " TEXT " + " DEFAULT NULL"); - + // Create table ocshares db.execSQL("CREATE TABLE " + ProviderTableMeta.OCSHARES_TABLE_NAME + "(" + ProviderTableMeta._ID + " INTEGER PRIMARY KEY, " @@ -673,6 +681,27 @@ public class FileContentProvider extends ContentProvider { + ProviderTableMeta.OCSHARES_USER_ID + " INTEGER, " + ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED + " INTEGER," + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + " TEXT );" ); + + upgraded = true; + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + } + } + if (!upgraded) + Log_OC.i("SQL", "OUT of the ADD in onUpgrade; oldVersion == " + oldVersion + ", newVersion == " + newVersion); + + if (oldVersion < 7 && newVersion >= 7) { + Log_OC.i("SQL", "Entering in the #7 ADD in onUpgrade"); + db.beginTransaction(); + try { + db .execSQL("ALTER TABLE " + ProviderTableMeta.FILE_TABLE_NAME + + " ADD COLUMN " + ProviderTableMeta.FILE_PERMISSIONS + " TEXT " + + " DEFAULT NULL"); + + db .execSQL("ALTER TABLE " + ProviderTableMeta.FILE_TABLE_NAME + + " ADD COLUMN " + ProviderTableMeta.FILE_REMOTE_ID + " TEXT " + + " DEFAULT NULL"); upgraded = true; db.setTransactionSuccessful(); @@ -682,6 +711,23 @@ public class FileContentProvider extends ContentProvider { } if (!upgraded) Log_OC.i("SQL", "OUT of the ADD in onUpgrade; oldVersion == " + oldVersion + ", newVersion == " + newVersion); + + if (oldVersion < 8 && newVersion >= 8) { + Log_OC.i("SQL", "Entering in the #8 ADD in onUpgrade"); + db.beginTransaction(); + try { + db .execSQL("ALTER TABLE " + ProviderTableMeta.FILE_TABLE_NAME + + " ADD COLUMN " + ProviderTableMeta.FILE_UPDATE_THUMBNAIL + " INTEGER " + + " DEFAULT 0"); + + upgraded = true; + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + } + } + if (!upgraded) + Log_OC.i("SQL", "OUT of the ADD in onUpgrade; oldVersion == " + oldVersion + ", newVersion == " + newVersion); } }