|
@@ -48,26 +48,21 @@ public class ArbitraryDataProvider {
|
|
|
}
|
|
|
|
|
|
public int deleteKeyForAccount(String account, String key) {
|
|
|
- int result = contentResolver.delete(
|
|
|
+ return contentResolver.delete(
|
|
|
ProviderMeta.ProviderTableMeta.CONTENT_URI_ARBITRARY_DATA,
|
|
|
ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_CLOUD_ID + " = ? AND " +
|
|
|
ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_KEY + "= ?",
|
|
|
new String[]{account, key}
|
|
|
);
|
|
|
-
|
|
|
- return result;
|
|
|
}
|
|
|
|
|
|
public int deleteForKeyWhereAccountNotIn(ArrayList<String> accounts, String key) {
|
|
|
-
|
|
|
- int result = contentResolver.delete(
|
|
|
+ return contentResolver.delete(
|
|
|
ProviderMeta.ProviderTableMeta.CONTENT_URI_ARBITRARY_DATA,
|
|
|
ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_CLOUD_ID + " NOT IN (?) AND " +
|
|
|
ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_KEY + "= ?",
|
|
|
new String[]{String.valueOf(accounts), key}
|
|
|
);
|
|
|
-
|
|
|
- return result;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -158,38 +153,6 @@ public class ArbitraryDataProvider {
|
|
|
return getIntegerValue(account.name, key);
|
|
|
}
|
|
|
|
|
|
- private ArrayList<String> getValues(Account account, String key) {
|
|
|
- Cursor cursor = contentResolver.query(
|
|
|
- ProviderMeta.ProviderTableMeta.CONTENT_URI_ARBITRARY_DATA,
|
|
|
- null,
|
|
|
- ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_CLOUD_ID + " = ? and " +
|
|
|
- ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_KEY + " = ?",
|
|
|
- new String[]{account.name, key},
|
|
|
- null
|
|
|
- );
|
|
|
-
|
|
|
- if (cursor != null) {
|
|
|
- ArrayList<String> list = new ArrayList<>();
|
|
|
- if (cursor.moveToFirst()) {
|
|
|
- do {
|
|
|
- String value = cursor.getString(cursor.getColumnIndex(
|
|
|
- ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_VALUE));
|
|
|
- if (value == null) {
|
|
|
- Log_OC.e(TAG, "Arbitrary value could not be created from cursor");
|
|
|
- } else {
|
|
|
- list.add(value);
|
|
|
- }
|
|
|
- } while (cursor.moveToNext());
|
|
|
- }
|
|
|
- cursor.close();
|
|
|
- return list;
|
|
|
- } else {
|
|
|
- Log_OC.e(TAG, "DB error restoring arbitrary values.");
|
|
|
- }
|
|
|
-
|
|
|
- return new ArrayList<>();
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Returns stored value as string or empty string
|
|
|
* @return string if value found or empty string
|