Merge change 617 into donut
* changes: Allow caller-supplied column aliases in queries even when a projection map is used.
This commit is contained in:
@@ -486,12 +486,20 @@ public class SQLiteQueryBuilder
|
|||||||
String userColumn = projectionIn[i];
|
String userColumn = projectionIn[i];
|
||||||
String column = mProjectionMap.get(userColumn);
|
String column = mProjectionMap.get(userColumn);
|
||||||
|
|
||||||
if (column == null) {
|
if (column != null) {
|
||||||
throw new IllegalArgumentException(
|
|
||||||
"Invalid column " + projectionIn[i]);
|
|
||||||
} else {
|
|
||||||
projection[i] = column;
|
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;
|
return projection;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user