Open
Conversation
The read cache can be avoided when querying the database, by using the new method com.activeandroid.query.From#setUseCache. Additionally we've fixed the read cache implementation, which was used only by the reflective (legacy) model filler. Now the read cache is applied regardless of the particular model filler in use. We keep the read cache enabled by default mainly for backwards compatibility reasons.
DB concurrency is tricky in Android. The following changes allow a better handling of multithreaded db access: - Write ahead logging is enabled - Connection is configured in onConfigure (SQLiteOpenHelper) - Transactions are made in non-exclusive mode References: - http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#enableWriteAheadLogging() - http://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper.html#onConfigure(android.database.sqlite.SQLiteDatabase) - http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.0.1_r1/android/database/sqlite/SQLiteDatabase.java#SQLiteDatabase.beginTransaction%28android.database.sqlite.SQLiteTransactionListener%2Cboolean%29 - https://www.sqlite.org/lockingv3.html#reserved_lock - https://www.sqlite.org/lang_transaction.html - http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#beginTransactionNonExclusive()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Commit messages should be clear enough. Please reach me if you need further clarifications.
Both changes were properly tested, but outside the test suite since I can't get it to work right now. Here's the test case: