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

Commit 8d45e4e4 authored by Vasu Nori's avatar Vasu Nori
Browse files

changes after review by API council

please refer to http://b/issue?id=2420299
parent aea16fb6
Loading
Loading
Loading
Loading
+21 −30
Original line number Diff line number Diff line
@@ -53070,40 +53070,40 @@
<parameter name="sleepAfterYieldDelay" type="long">
</parameter>
</method>
<field name="CREATE_IF_NECESSARY"
<field name="CONFLICT_ABORT"
 type="int"
 transient="false"
 volatile="false"
 value="268435456"
 value="2"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="NO_LOCALIZED_COLLATORS"
<field name="CONFLICT_FAIL"
 type="int"
 transient="false"
 volatile="false"
 value="16"
 value="3"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="OPEN_READONLY"
<field name="CONFLICT_IGNORE"
 type="int"
 transient="false"
 volatile="false"
 value="1"
 value="4"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="OPEN_READWRITE"
<field name="CONFLICT_NONE"
 type="int"
 transient="false"
 volatile="false"
@@ -53114,86 +53114,77 @@
 visibility="public"
>
</field>
<field name="SQLITE_MAX_LIKE_PATTERN_LENGTH"
<field name="CONFLICT_REPLACE"
 type="int"
 transient="false"
 volatile="false"
 value="50000"
 value="5"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
</class>
<class name="SQLiteDatabase.ConflictAlgorithm"
 extends="java.lang.Object"
 abstract="false"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
<field name="ABORT"
<field name="CONFLICT_ROLLBACK"
 type="int"
 transient="false"
 volatile="false"
 value="2"
 value="1"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="FAIL"
<field name="CREATE_IF_NECESSARY"
 type="int"
 transient="false"
 volatile="false"
 value="3"
 value="268435456"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="IGNORE"
<field name="NO_LOCALIZED_COLLATORS"
 type="int"
 transient="false"
 volatile="false"
 value="4"
 value="16"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="NONE"
<field name="OPEN_READONLY"
 type="int"
 transient="false"
 volatile="false"
 value="0"
 value="1"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="REPLACE"
<field name="OPEN_READWRITE"
 type="int"
 transient="false"
 volatile="false"
 value="5"
 value="0"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="ROLLBACK"
<field name="SQLITE_MAX_LIKE_PATTERN_LENGTH"
 type="int"
 transient="false"
 volatile="false"
 value="1"
 value="50000"
 static="true"
 final="true"
 deprecated="not deprecated"
+59 −63
Original line number Diff line number Diff line
@@ -66,7 +66,6 @@ public class SQLiteDatabase extends SQLiteClosable {
     * Algorithms used in ON CONFLICT clause
     * http://www.sqlite.org/lang_conflict.html
     */
    public static final class ConflictAlgorithm {
    /**
     *  When a constraint violation occurs, an immediate ROLLBACK occurs,
     * thus ending the current transaction, and the command aborts with a
@@ -74,14 +73,14 @@ public class SQLiteDatabase extends SQLiteClosable {
     * (other than the implied transaction that is created on every command)
     *  then this algorithm works the same as ABORT.
     */
        public static final int ROLLBACK = 1;
    public static final int CONFLICT_ROLLBACK = 1;

    /**
     * When a constraint violation occurs,no ROLLBACK is executed
     * so changes from prior commands within the same transaction
     * are preserved. This is the default behavior.
     */
        public static final int ABORT = 2;
    public static final int CONFLICT_ABORT = 2;

    /**
     * When a constraint violation occurs, the command aborts with a return
@@ -89,7 +88,7 @@ public class SQLiteDatabase extends SQLiteClosable {
     * the command made prior to encountering the constraint violation
     * are preserved and are not backed out.
     */
        public static final int FAIL = 3;
    public static final int CONFLICT_FAIL = 3;

    /**
     * When a constraint violation occurs, the one row that contains
@@ -98,7 +97,7 @@ public class SQLiteDatabase extends SQLiteClosable {
     * after the row that contained the constraint violation continue to be
     * inserted or updated normally. No error is returned.
     */
        public static final int IGNORE = 4;
    public static final int CONFLICT_IGNORE = 4;

    /**
     * When a UNIQUE constraint violation occurs, the pre-existing rows that
@@ -113,18 +112,15 @@ public class SQLiteDatabase extends SQLiteClosable {
     * it does not invoke delete triggers on those rows.
     *  This behavior might change in a future release.
     */
        public static final int REPLACE = 5;
    public static final int CONFLICT_REPLACE = 5;

    /**
     * use the following when no conflict action is specified.
     */
        public static final int NONE = 0;
        private static final String[] VALUES = new String[]
    public static final int CONFLICT_NONE = 0;
    private static final String[] CONFLICT_VALUES = new String[]
            {"", " OR ROLLBACK ", " OR ABORT ", " OR FAIL ", " OR IGNORE ", " OR REPLACE "};

        private ConflictAlgorithm() {}  // disable instantiation of this class
    }

    /**
     * Maximum Length Of A LIKE Or GLOB Pattern
     * The pattern matching algorithm used in the default LIKE and GLOB implementation
@@ -1341,7 +1337,7 @@ public class SQLiteDatabase extends SQLiteClosable {
     */
    public long insert(String table, String nullColumnHack, ContentValues values) {
        try {
            return insertWithOnConflict(table, nullColumnHack, values, ConflictAlgorithm.NONE);
            return insertWithOnConflict(table, nullColumnHack, values, CONFLICT_NONE);
        } catch (SQLException e) {
            Log.e(TAG, "Error inserting " + values, e);
            return -1;
@@ -1363,7 +1359,7 @@ public class SQLiteDatabase extends SQLiteClosable {
     */
    public long insertOrThrow(String table, String nullColumnHack, ContentValues values)
            throws SQLException {
        return insertWithOnConflict(table, nullColumnHack, values, ConflictAlgorithm.NONE);
        return insertWithOnConflict(table, nullColumnHack, values, CONFLICT_NONE);
    }

    /**
@@ -1380,7 +1376,7 @@ public class SQLiteDatabase extends SQLiteClosable {
    public long replace(String table, String nullColumnHack, ContentValues initialValues) {
        try {
            return insertWithOnConflict(table, nullColumnHack, initialValues,
                    ConflictAlgorithm.REPLACE);
                    CONFLICT_REPLACE);
        } catch (SQLException e) {
            Log.e(TAG, "Error inserting " + initialValues, e);
            return -1;
@@ -1402,7 +1398,7 @@ public class SQLiteDatabase extends SQLiteClosable {
    public long replaceOrThrow(String table, String nullColumnHack,
            ContentValues initialValues) throws SQLException {
        return insertWithOnConflict(table, nullColumnHack, initialValues,
                ConflictAlgorithm.REPLACE);
                CONFLICT_REPLACE);
    }

    /**
@@ -1415,10 +1411,10 @@ public class SQLiteDatabase extends SQLiteClosable {
     * @param initialValues this map contains the initial column values for the
     *            row. The keys should be the column names and the values the
     *            column values
     * @param conflictAlgorithm  {@link ConflictAlgorithm} for insert conflict resolver
     * @param conflictAlgorithm for insert conflict resolver
     * @return the row ID of the newly inserted row
     * OR the primary key of the existing row if the input param 'conflictAlgorithm' =
     * {@link ConflictAlgorithm#IGNORE}
     * {@link #CONFLICT_IGNORE}
     * OR -1 if any error
     */
    public long insertWithOnConflict(String table, String nullColumnHack,
@@ -1430,7 +1426,7 @@ public class SQLiteDatabase extends SQLiteClosable {
        // Measurements show most sql lengths <= 152
        StringBuilder sql = new StringBuilder(152);
        sql.append("INSERT");
        sql.append(ConflictAlgorithm.VALUES[conflictAlgorithm]);
        sql.append(CONFLICT_VALUES[conflictAlgorithm]);
        sql.append(" INTO ");
        sql.append(table);
        // Measurements show most values lengths < 40
@@ -1554,7 +1550,7 @@ public class SQLiteDatabase extends SQLiteClosable {
     * @return the number of rows affected
     */
    public int update(String table, ContentValues values, String whereClause, String[] whereArgs) {
        return updateWithOnConflict(table, values, whereClause, whereArgs, ConflictAlgorithm.NONE);
        return updateWithOnConflict(table, values, whereClause, whereArgs, CONFLICT_NONE);
    }

    /**
@@ -1565,7 +1561,7 @@ public class SQLiteDatabase extends SQLiteClosable {
     *            valid value that will be translated to NULL.
     * @param whereClause the optional WHERE clause to apply when updating.
     *            Passing null will update all rows.
     * @param conflictAlgorithm  {@link ConflictAlgorithm} for update conflict resolver
     * @param conflictAlgorithm for update conflict resolver
     * @return the number of rows affected
     */
    public int updateWithOnConflict(String table, ContentValues values,
@@ -1580,7 +1576,7 @@ public class SQLiteDatabase extends SQLiteClosable {

        StringBuilder sql = new StringBuilder(120);
        sql.append("UPDATE ");
        sql.append(ConflictAlgorithm.VALUES[conflictAlgorithm]);
        sql.append(CONFLICT_VALUES[conflictAlgorithm]);
        sql.append(table);
        sql.append(" SET ");

+6 −1
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ public abstract class SQLiteProgram extends SQLiteClosable {
    }

    /**
     * @deprecated use this.compiledStatement.compile instead
     * @deprecated This method is deprecated and must not be used.
     *
     * @param sql the SQL string to compile
     * @param forceCompilation forces the SQL to be recompiled in the event that there is an
@@ -223,6 +223,7 @@ public abstract class SQLiteProgram extends SQLiteClosable {
    }

    /**
     * @deprecated This method is deprecated and must not be used.
     * Compiles SQL into a SQLite program.
     *
     * <P>The database lock must be held when calling this method.
@@ -230,6 +231,10 @@ public abstract class SQLiteProgram extends SQLiteClosable {
     */
    @Deprecated
    protected final native void native_compile(String sql);

    /**
     * @deprecated This method is deprecated and must not be used.
     */
    @Deprecated
    protected final native void native_finalize();