SQLDatabase
The use of ThreadLocal underpins SQLDatabase's thread-safety.
A thread can acquire at most one connection session per database instance. Sessions hold at most one connection at any given time, and exclusively. Sessions control all access to a database's connections and each session is thread-bound. This prevents two threads from ever sharing a single connection.
This is the same strategy Google employs in the Android SDK.
See also
Constructors
Properties
Functions
Executes a cancellable query. If the cancellationSignal is cancelled from another thread, the query will be aborted at the earliest opportunity and an OperationCancelledException will be thrown.
Returns a forward-only streaming ICursor backed by a ForwardCursor. The caller must close the returned cursor to release the underlying prepared statement back to the connection's cache and to release the session's connection back to the pool.
Registers a progress handler that is invoked periodically during long-running SQL statements on all database connections managed by this database. If the handler returns non-zero, the operation is interrupted.