am 9ae8873: Merge change 617 into donut
Merge commit '9ae8873ed83035e8527526e2cc1a189caf0e8d9e' * commit '9ae8873ed83035e8527526e2cc1a189caf0e8d9e': Allow caller-supplied column aliases in queries even when a projection map is used.
This commit is contained in:
committed by
The Android Open Source Project
commit
090d32b275
@@ -489,12 +489,20 @@ public class SQLiteQueryBuilder
|
||||
String userColumn = projectionIn[i];
|
||||
String column = mProjectionMap.get(userColumn);
|
||||
|
||||
if (column == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Invalid column " + projectionIn[i]);
|
||||
} else {
|
||||
if (column != null) {
|
||||
projection[i] = column;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (userColumn.contains(" AS ")
|
||||
|| userColumn.contains(" as ")) {
|
||||
/* A column alias already exist */
|
||||
projection[i] = userColumn;
|
||||
continue;
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("Invalid column "
|
||||
+ projectionIn[i]);
|
||||
}
|
||||
return projection;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user