SQLiteDatabase.BeginTransactionReadOnly Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Begins a transaction in DEFERRED mode, with the android-specific constraint that the transaction is read-only.
[Android.Runtime.Register("beginTransactionReadOnly", "()V", "GetBeginTransactionReadOnlyHandler", ApiSince=35)]
public virtual void BeginTransactionReadOnly ();
[<Android.Runtime.Register("beginTransactionReadOnly", "()V", "GetBeginTransactionReadOnlyHandler", ApiSince=35)>]
abstract member BeginTransactionReadOnly : unit -> unit
override this.BeginTransactionReadOnly : unit -> unit
- Attributes
Remarks
Begins a transaction in DEFERRED mode, with the android-specific constraint that the transaction is read-only. The database may not be modified inside a read-only transaction.
Read-only transactions may run concurrently with other read-only transactions, and if the database is in WAL mode, they may also run concurrently with IMMEDIATE or EXCLUSIVE transactions.
Transactions can be nested. However, the behavior of the transaction is not altered by nested transactions. A nested transaction may be any of the three transaction types but if the outermost type is read-only then nested transactions remain read-only, regardless of how they are started.
Here is the standard idiom for read-only transactions:
db.beginTransactionReadOnly();
try {
...
} finally {
db.endTransaction();
}
Java documentation for android.database.sqlite.SQLiteDatabase.beginTransactionReadOnly()
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.