Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Update further java classfiles to match the latest Android code. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
e782e01fbe7dd7b3c78a359cf8b98756 |
User & Date: | dan 2017-11-28 15:46:24.207 |
Context
2017-11-28
| ||
17:05 | Update some other files to better match stock Android. (check-in: 253313a7ee user: dan tags: trunk) | |
15:46 | Update further java classfiles to match the latest Android code. (check-in: e782e01fbe user: dan tags: trunk) | |
08:22 | Update a couple of java source files to more closely match their Android counterparts. (check-in: 20bdb663b0 user: dan tags: trunk) | |
Changes
Changes to sqlite3/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java.
︙ | |||
1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 | 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 | + + + + + + + + + + + + + + + | } finally { statement.close(); } } finally { releaseReference(); } } /** * Verifies that a SQL SELECT statement is valid by compiling it. * If the SQL statement is not valid, this method will throw a {@link SQLiteException}. * * @param sql SQL to be validated * @param cancellationSignal A signal to cancel the operation in progress, or null if none. * If the operation is canceled, then {@link OperationCanceledException} will be thrown * when the query is executed. * @throws SQLiteException if {@code sql} is invalid */ public void validateSql(String sql, CancellationSignal cancellationSignal) { getThreadSession().prepare(sql, getThreadDefaultConnectionFlags(/* readOnly =*/ true), cancellationSignal, null); } /** * Returns true if the database is opened as read only. * * @return True if database is opened as read only. */ public boolean isReadOnly() { |
︙ |
Changes to sqlite3/src/main/java/org/sqlite/database/sqlite/SQLiteOpenHelper.java.
︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | + - + | * See the License for the specific language governing permissions and * limitations under the License. */ /* ** Modified to support SQLite extensions by the SQLite developers: ** sqlite-dev@sqlite.org. */ package org.sqlite.database.sqlite; import android.content.Context; import org.sqlite.database.DatabaseErrorHandler; |
︙ | |||
55 56 57 58 59 60 61 62 63 64 65 66 67 68 | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | + | // wanted getWritableDatabase. private static final boolean DEBUG_STRICT_READONLY = false; private final Context mContext; private final String mName; private final CursorFactory mFactory; private final int mNewVersion; private final int mMinimumSupportedVersion; private SQLiteDatabase mDatabase; private boolean mIsInitializing; private boolean mEnableWriteAheadLogging; private final DatabaseErrorHandler mErrorHandler; /** |
︙ | |||
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | * {@link #onUpgrade} will be used to upgrade the database; if the database is * newer, {@link #onDowngrade} will be used to downgrade the database * @param errorHandler the {@link DatabaseErrorHandler} to be used when sqlite reports database * corruption, or null to use the default error handler. */ public SQLiteOpenHelper(Context context, String name, CursorFactory factory, int version, DatabaseErrorHandler errorHandler) { this(context, name, factory, version, 0, errorHandler); } /** * Same as {@link #SQLiteOpenHelper(Context, String, CursorFactory, int, DatabaseErrorHandler)} * but also accepts an integer minimumSupportedVersion as a convenience for upgrading very old * versions of this database that are no longer supported. If a database with older version that * minimumSupportedVersion is found, it is simply deleted and a new database is created with the * given name and version * * @param context to use to open or create the database * @param name the name of the database file, null for a temporary in-memory database * @param factory to use for creating cursor objects, null for default * @param version the required version of the database * @param minimumSupportedVersion the minimum version that is supported to be upgraded to * {@code version} via {@link #onUpgrade}. If the current database version is lower * than this, database is simply deleted and recreated with the version passed in * {@code version}. {@link #onBeforeDelete} is called before deleting the database * when this happens. This is 0 by default. * @param errorHandler the {@link DatabaseErrorHandler} to be used when sqlite reports database * corruption, or null to use the default error handler. * @see #onBeforeDelete(SQLiteDatabase) * @see #SQLiteOpenHelper(Context, String, CursorFactory, int, DatabaseErrorHandler) * @see #onUpgrade(SQLiteDatabase, int, int) * @hide */ public SQLiteOpenHelper(Context context, String name, CursorFactory factory, int version, int minimumSupportedVersion, DatabaseErrorHandler errorHandler) { if (version < 1) throw new IllegalArgumentException("Version must be >= 1, was " + version); mContext = context; mName = name; mFactory = factory; mNewVersion = version; mErrorHandler = errorHandler; mMinimumSupportedVersion = Math.max(0, minimumSupportedVersion); } /** * Return the name of the SQLite database being opened, as given to * the constructor. */ public String getDatabaseName() { |
︙ | |||
222 223 224 225 226 227 228 | 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | - + | try { if (DEBUG_STRICT_READONLY && !writable) { final String path = mContext.getDatabasePath(mName).getPath(); db = SQLiteDatabase.openDatabase(path, mFactory, SQLiteDatabase.OPEN_READONLY, mErrorHandler); } else { db = SQLiteDatabase.openOrCreateDatabase( |
︙ | |||
246 247 248 249 250 251 252 | 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + | final int version = db.getVersion(); if (version != mNewVersion) { if (db.isReadOnly()) { throw new SQLiteException("Can't upgrade read-only database from version " + db.getVersion() + " to " + mNewVersion + ": " + mName); } if (version > 0 && version < mMinimumSupportedVersion) { File databaseFile = new File(db.getPath()); onBeforeDelete(db); db.close(); if (SQLiteDatabase.deleteDatabase(databaseFile)) { mIsInitializing = false; return getDatabaseLocked(writable); } else { throw new IllegalStateException("Unable to delete obsolete database " + mName + " with version " + version); } } else { |
︙ | |||
293 294 295 296 297 298 299 | 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | - - + + - - - - - - - + + + + + + + + - - + + + + + + + + + + + + + + + | if (mDatabase != null && mDatabase.isOpen()) { mDatabase.close(); mDatabase = null; } } /** |
︙ |
Changes to sqlite3/src/main/java/org/sqlite/database/sqlite/SQLiteQueryBuilder.java.
︙ | |||
386 387 388 389 390 391 392 | 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | - - + - - - - - - - - - - | // The idea is to ensure that the selection clause is a valid SQL expression // by compiling it twice: once wrapped in parentheses and once as // originally specified. An attacker cannot create an expression that // would escape the SQL expression while maintaining balanced parentheses // in both the wrapped and original forms. String sqlForValidation = buildQuery(projectionIn, "(" + selection + ")", groupBy, having, sortOrder, limit); |
︙ |
Changes to sqlite3/src/main/java/org/sqlite/database/sqlite/SQLiteStatement.java.
︙ | |||
35 36 37 38 39 40 41 | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | - + - + | super(db, sql, bindArgs, null); } /** * Execute this SQL statement, if it is not a SELECT / INSERT / DELETE / UPDATE, for example * CREATE / DROP table, view, trigger, index etc. * |
︙ | |||
77 78 79 80 81 82 83 | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | - + | /** * Execute this SQL statement and return the ID of the row inserted due to this call. * The SQL statement should be an INSERT for this to be a useful call. * * @return the row ID of the last row inserted, if this insert is successful. -1 otherwise. * |
︙ | |||
99 100 101 102 103 104 105 | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | - + - + - + | /** * Execute a statement that returns a 1 by 1 table with a numeric value. * For example, SELECT COUNT(*) FROM table; * * @return The result of the query. * |
︙ |
Deleted sqlite3/src/main/java/org/sqlite/database/sqlite/SqliteWrapper.java.
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|