fix unified query columns for select*fragment

This commit is contained in:
Vincent Breitmoser 2014-04-18 21:00:13 +02:00
parent b1cd669f14
commit dd8a7c93ad
2 changed files with 5 additions and 6 deletions

View File

@ -109,7 +109,7 @@ public class KeychainContract {
public static final String VERIFIED = CertsColumns.VERIFIED; public static final String VERIFIED = CertsColumns.VERIFIED;
public static final String HAS_ANY_SECRET = "has_any_secret"; public static final String HAS_ANY_SECRET = "has_any_secret";
public static final String HAS_ENCRYPT = "has_encrypt"; public static final String HAS_ENCRYPT = "has_encrypt";
public static final String HAS_SIGN = "has_encrypt"; public static final String HAS_SIGN = "has_sign";
public static final Uri CONTENT_URI = BASE_CONTENT_URI_INTERNAL.buildUpon() public static final Uri CONTENT_URI = BASE_CONTENT_URI_INTERNAL.buildUpon()
.appendPath(BASE_KEY_RINGS).build(); .appendPath(BASE_KEY_RINGS).build();

View File

@ -261,24 +261,23 @@ public class KeychainProvider extends ContentProvider {
+ " = " + Tables.KEYS + "." + Keys.MASTER_KEY_ID + " = " + Tables.KEYS + "." + Keys.MASTER_KEY_ID
+ ")) AS " + KeyRings.HAS_ANY_SECRET); + ")) AS " + KeyRings.HAS_ANY_SECRET);
projectionMap.put(KeyRings.HAS_ENCRYPT, projectionMap.put(KeyRings.HAS_ENCRYPT,
"(EXISTS (SELECT COUNT(*) FROM " + Tables.KEYS + " AS k" "(EXISTS (SELECT * FROM " + Tables.KEYS + " AS k"
+" WHERE k." + Keys.MASTER_KEY_ID +" WHERE k." + Keys.MASTER_KEY_ID
+ " = " + Tables.KEYS + "." + Keys.MASTER_KEY_ID + " = " + Tables.KEYS + "." + Keys.MASTER_KEY_ID
+ " AND k." + Keys.IS_REVOKED + " = 0" + " AND k." + Keys.IS_REVOKED + " = 0"
+ " AND k." + Keys.HAS_SECRET + " = 1"
+ " AND k." + Keys.CAN_ENCRYPT + " = 1" + " AND k." + Keys.CAN_ENCRYPT + " = 1"
+ " AND ( k." + Keys.EXPIRY + " IS NULL OR k." + Keys.EXPIRY + " AND ( k." + Keys.EXPIRY + " IS NULL OR k." + Keys.EXPIRY
+ " >= '" + new Date().getTime() / 1000 + "' )" + " >= " + new Date().getTime() / 1000 + " )"
+ ")) AS " + KeyRings.HAS_ENCRYPT); + ")) AS " + KeyRings.HAS_ENCRYPT);
projectionMap.put(KeyRings.HAS_SIGN, projectionMap.put(KeyRings.HAS_SIGN,
"(EXISTS (SELECT COUNT(*) FROM " + Tables.KEYS + " AS k" "(EXISTS (SELECT * FROM " + Tables.KEYS + " AS k"
+" WHERE k." + Keys.MASTER_KEY_ID +" WHERE k." + Keys.MASTER_KEY_ID
+ " = " + Tables.KEYS + "." + Keys.MASTER_KEY_ID + " = " + Tables.KEYS + "." + Keys.MASTER_KEY_ID
+ " AND k." + Keys.IS_REVOKED + " = 0" + " AND k." + Keys.IS_REVOKED + " = 0"
+ " AND k." + Keys.HAS_SECRET + " = 1" + " AND k." + Keys.HAS_SECRET + " = 1"
+ " AND k." + Keys.CAN_SIGN + " = 1" + " AND k." + Keys.CAN_SIGN + " = 1"
+ " AND ( k." + Keys.EXPIRY + " IS NULL OR k." + Keys.EXPIRY + " AND ( k." + Keys.EXPIRY + " IS NULL OR k." + Keys.EXPIRY
+ " >= '" + new Date().getTime() / 1000 + "' )" + " >= " + new Date().getTime() / 1000 + " )"
+ ")) AS " + KeyRings.HAS_SIGN); + ")) AS " + KeyRings.HAS_SIGN);
qb.setProjectionMap(projectionMap); qb.setProjectionMap(projectionMap);