Merge "Introducing "strict project map"." into froyo
This commit is contained in:
committed by
Android (Google) Code Review
commit
5304d8fdc9
@@ -43,6 +43,7 @@ public class SQLiteQueryBuilder
|
||||
private StringBuilder mWhereClause = null; // lazily created
|
||||
private boolean mDistinct;
|
||||
private SQLiteDatabase.CursorFactory mFactory;
|
||||
private boolean mStrictProjectionMap;
|
||||
|
||||
public SQLiteQueryBuilder() {
|
||||
mDistinct = false;
|
||||
@@ -143,6 +144,13 @@ public class SQLiteQueryBuilder
|
||||
mFactory = factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public void setStrictProjectionMap(boolean flag) {
|
||||
mStrictProjectionMap = flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build an SQL query string from the given clauses.
|
||||
*
|
||||
@@ -505,8 +513,8 @@ public class SQLiteQueryBuilder
|
||||
continue;
|
||||
}
|
||||
|
||||
if (userColumn.contains(" AS ")
|
||||
|| userColumn.contains(" as ")) {
|
||||
if (!mStrictProjectionMap &&
|
||||
( userColumn.contains(" AS ") || userColumn.contains(" as "))) {
|
||||
/* A column alias already exist */
|
||||
projection[i] = userColumn;
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user