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

Commit 090d32b2 authored by Android (Google) Code Review's avatar Android (Google) Code Review Committed by The Android Open Source Project
Browse files

am 9ae8873e: Merge change 617 into donut

Merge commit '9ae8873e'

* commit '9ae8873e':
  Allow caller-supplied column aliases in queries even when a projection map is used.
parents ef77be95 9ae8873e
Loading
Loading
Loading
Loading
+12 −4
Original line number Original line Diff line number Diff line
@@ -489,12 +489,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 {