mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -05:00
Fix provider for API_ACCOUNTS
This commit is contained in:
parent
ba37fc254d
commit
2e063a42ed
@ -65,7 +65,7 @@ public class KeychainContract {
|
||||
String ENCRYPTION_ALGORITHM = "encryption_algorithm";
|
||||
String HASH_ALORITHM = "hash_algorithm";
|
||||
String COMPRESSION = "compression";
|
||||
String PACKAGE_NAME_FK = "package_name"; // foreign key to api_apps.package_name
|
||||
String PACKAGE_NAME = "package_name"; // foreign key to api_apps.package_name
|
||||
}
|
||||
|
||||
public static final class KeyTypes {
|
||||
|
@ -88,10 +88,10 @@ public class KeychainDatabase extends SQLiteOpenHelper {
|
||||
+ ApiAppsAccountsColumns.ENCRYPTION_ALGORITHM + " INTEGER, "
|
||||
+ ApiAppsAccountsColumns.HASH_ALORITHM + " INTEGER, "
|
||||
+ ApiAppsAccountsColumns.COMPRESSION + " INTEGER, "
|
||||
+ ApiAppsAccountsColumns.PACKAGE_NAME_FK + " TEXT NOT NULL, "
|
||||
+ ApiAppsAccountsColumns.PACKAGE_NAME + " TEXT NOT NULL, "
|
||||
+ "UNIQUE(" + ApiAppsAccountsColumns.ACCOUNT_NAME + ", "
|
||||
+ ApiAppsAccountsColumns.PACKAGE_NAME_FK + "), "
|
||||
+ "FOREIGN KEY(" + ApiAppsAccountsColumns.PACKAGE_NAME_FK + ") REFERENCES "
|
||||
+ ApiAppsAccountsColumns.PACKAGE_NAME + "), "
|
||||
+ "FOREIGN KEY(" + ApiAppsAccountsColumns.PACKAGE_NAME + ") REFERENCES "
|
||||
+ Tables.API_APPS + "(" + ApiAppsColumns.PACKAGE_NAME + ") ON DELETE CASCADE)";
|
||||
|
||||
KeychainDatabase(Context context) {
|
||||
|
@ -687,13 +687,13 @@ public class KeychainProvider extends ContentProvider {
|
||||
break;
|
||||
case API_ACCOUNTS:
|
||||
qb.setTables(Tables.API_ACCOUNTS);
|
||||
qb.appendWhere(Tables.API_ACCOUNTS + "." + ApiAccounts.PACKAGE_NAME + " = ");
|
||||
qb.appendWhereEscapeString(uri.getPathSegments().get(1));
|
||||
|
||||
break;
|
||||
case API_ACCOUNTS_BY_ACCOUNT_NAME:
|
||||
qb.setTables(Tables.API_ACCOUNTS + " INNER JOIN " + Tables.API_APPS + " ON " + "("
|
||||
+ Tables.API_APPS + "." + ApiApps.PACKAGE_NAME + " = " + Tables.API_ACCOUNTS + "."
|
||||
+ ApiAccounts.PACKAGE_NAME_FK + " )");
|
||||
qb.appendWhere(Tables.API_APPS + "." + ApiApps.PACKAGE_NAME + " = ");
|
||||
qb.setTables(Tables.API_ACCOUNTS);
|
||||
qb.appendWhere(Tables.API_ACCOUNTS + "." + ApiAccounts.PACKAGE_NAME + " = ");
|
||||
qb.appendWhereEscapeString(uri.getPathSegments().get(1));
|
||||
|
||||
qb.appendWhere(" AND " + Tables.API_ACCOUNTS + "." + ApiAccounts.ACCOUNT_NAME + " = ");
|
||||
@ -800,7 +800,7 @@ public class KeychainProvider extends ContentProvider {
|
||||
// set foreign key automatically based on given uri
|
||||
// e.g., api_apps/com.example.app/accounts/
|
||||
String packageName = uri.getPathSegments().get(1);
|
||||
values.put(ApiAccounts.PACKAGE_NAME_FK, packageName);
|
||||
values.put(ApiAccounts.PACKAGE_NAME, packageName);
|
||||
|
||||
Log.d(Constants.TAG, "provider packageName: " + packageName);
|
||||
|
||||
@ -1061,7 +1061,7 @@ public class KeychainProvider extends ContentProvider {
|
||||
andSelection = " AND (" + selection + ")";
|
||||
}
|
||||
|
||||
return ApiAccounts.PACKAGE_NAME_FK + "=" + packageName + " AND "
|
||||
return ApiAccounts.PACKAGE_NAME + "=" + packageName + " AND "
|
||||
+ ApiAccounts.ACCOUNT_NAME + "=" + accountName
|
||||
+ andSelection;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user