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

Commit 23dbb2b4 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge changes from topic "columnz"

* changes:
  Annotation for ContentProvider columns.
  Add accessor methods to aid testing.
parents 6b902abf 9c41bda0
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -13064,6 +13064,10 @@ package android.database.sqlite {
    method public String buildUnionSubQuery(String, String[], java.util.Set<java.lang.String>, int, String, String, String, String);
    method @Deprecated public String buildUnionSubQuery(String, String[], java.util.Set<java.lang.String>, int, String, String, String[], String, String);
    method public int delete(@NonNull android.database.sqlite.SQLiteDatabase, @Nullable String, @Nullable String[]);
    method public android.database.sqlite.SQLiteDatabase.CursorFactory getCursorFactory();
    method public boolean getDistinct();
    method public java.util.Map<java.lang.String,java.lang.String> getProjectionMap();
    method public boolean getStrict();
    method public String getTables();
    method public android.database.Cursor query(android.database.sqlite.SQLiteDatabase, String[], String, String[], String, String, String);
    method public android.database.Cursor query(android.database.sqlite.SQLiteDatabase, String[], String, String[], String, String, String, String);
+42 −0
Original line number Diff line number Diff line
@@ -76,6 +76,14 @@ public class SQLiteQueryBuilder {
        mDistinct = distinct;
    }

    /**
     * Get if the query is marked as DISTINCT, as last configured by
     * {@link #setDistinct(boolean)}.
     */
    public boolean getDistinct() {
        return mDistinct;
    }

    /**
     * Returns the list of tables being queried
     *
@@ -166,6 +174,14 @@ public class SQLiteQueryBuilder {
        mProjectionMap = columnMap;
    }

    /**
     * Gets the projection map for the query, as last configured by
     * {@link #setProjectionMap(Map)}.
     */
    public Map<String, String> getProjectionMap() {
        return mProjectionMap;
    }

    /**
     * Sets a projection greylist of columns that will be allowed through, even
     * when {@link #setStrict(boolean)} is enabled. This provides a way for
@@ -177,6 +193,16 @@ public class SQLiteQueryBuilder {
        mProjectionGreylist = projectionGreylist;
    }

    /**
     * Gets the projection greylist for the query, as last configured by
     * {@link #setProjectionGreylist(List)}.
     *
     * @hide
     */
    public List<Pattern> getProjectionGreylist() {
        return mProjectionGreylist;
    }

    /**
     * Sets the cursor factory to be used for the query.  You can use
     * one factory for all queries on a database but it is normally
@@ -188,6 +214,14 @@ public class SQLiteQueryBuilder {
        mFactory = factory;
    }

    /**
     * Sets the cursor factory to be used for the query, as last configured by
     * {@link #setCursorFactory(android.database.sqlite.SQLiteDatabase.CursorFactory)}.
     */
    public SQLiteDatabase.CursorFactory getCursorFactory() {
        return mFactory;
    }

    /**
     * When set, the selection is verified against malicious arguments.
     * When using this class to create a statement using
@@ -213,6 +247,14 @@ public class SQLiteQueryBuilder {
        mStrict = flag;
    }

    /**
     * Get if the query is marked as strict, as last configured by
     * {@link #setStrict(boolean)}.
     */
    public boolean getStrict() {
        return mStrict;
    }

    /**
     * Build an SQL query string from the given clauses.
     *
+5 −4
Original line number Diff line number Diff line
@@ -16,17 +16,18 @@

package android.provider;

public interface BaseColumns
{
import android.database.Cursor;

public interface BaseColumns {
    /**
     * The unique ID for a row.
     * <P>Type: INTEGER (long)</P>
     */
    @Column(Cursor.FIELD_TYPE_INTEGER)
    public static final String _ID = "_id";

    /**
     * The count of rows in a directory.
     * <P>Type: INTEGER</P>
     */
    // @Column(Cursor.FIELD_TYPE_INTEGER)
    public static final String _COUNT = "_count";
}
+50 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.provider;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

/**
 * Denotes that a field is a {@link ContentProvider} column. It can be used as a
 * key for {@link ContentValues} when inserting or updating data, or as a
 * projection when querying.
 *
 * @hide
 */
@Documented
@Retention(RUNTIME)
@Target({FIELD})
public @interface Column {
    /**
     * The {@link Cursor#getType(int)} of the data stored in this column.
     */
    int value();

    /**
     * This column is read-only and cannot be defined during insert or updates.
     */
    boolean readOnly() default false;
}
+168 −143

File changed.

Preview size limit exceeded, changes collapsed.