Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9ae8873e authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 617 into donut

* changes:
  Allow caller-supplied column aliases in queries even when a projection map is used.
parents 9f98f79f 99c4483c
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -486,12 +486,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 {