Group ID has changed to com.squareup.sqlbrite2.
- New: RxJava 2.x support. Backpressure is no longer supported as evidenced by the use of
Observable. If you want to slow down query notifications based on backpressure or another metric like time then you should apply those operators yourself. - New:
mapToOptionalfor queries that return 0 or 1 rows. - New:
sqlbrite-kotlinmodule providesmapTo*extension functions forObservable<Query>. - New:
sqlbrite-interopmodule allows bridging 1.x and 2.x libraries together so that notifications from each trigger queries from the other.
Note: This version only supports RxJava 2.
- Internal architecture changes to support the upcoming 2.0 release and a bridge allowing both 1.x and 2.x to be used at the same time.
- Fix: Correct spelling of
getWritableDatabase()to matchSQLiteOpenHelper.
- New: Expose
getReadableDatabase()andgetWriteableDatabase()convenience methods. - Fix: Do not cache instances of the readable and writable database internally as the framework does this by default.
- RxJava dependency updated to 1.2.3.
- Restore
@WorkerThreadannotations to methods which do I/O. If you're using Java 8 with Retrolambda or Jack you need to use version 2.3 or newer of the Android Gradle plugin to have these annotations correctly handled by lint.
- New: A
Transformer<Query, Query>can be supplied which is applied to each returned observable. - New:
newNonExclusiveTransaction()starts transactions inIMMEDIATEmode. See the platform or SQLite documentation for more information. - New: APIs for insert/update/delete which allow providing a compiled
SQLiteStatement.
- New: Allow
mapTo*mappers to returnnullvalues. This is useful when querying on a single, nullable column for whichnullis a valid value. - Fix: When
mapToOnedoes not emit a value downstream, request another value from upstream to ensure fixed-item requests (such astake(1)) as properly honored. - Fix: Add logging to synchronous
executemethods.
QueryObservableconstructor is now public allow instances to be created for tests.
- Fix: Document explicitly and correctly handle the fact that
Query.run()can returnnullin some situations. ThemapToOne,mapToOneOrDefault,mapToList, andasRowshelpers have all been updated to handle this case and each is documented with their respective behavior.
- Fix: Apply backpressure strategy between database/content provider and the supplied
Scheduler. This guards against backpressure exceptions when the scheduler is unable to keep up with the rate at which queries are being triggered. - Fix: Indent the subsequent lines of a multi-line queries when logging.
-
New: Require a
Schedulerwhen wrapping a database or content provider which will be used when sending query triggers. This allows the query to be run in subsequent operators without needing an additionalobserveOn. It also eliminates the need to usesubscribeOnsince the suppliedSchedulerwill be used for all emissions (similar to RxJava'stimer,interval, etc.).This also corrects a potential violation of the RxJava contract and potential source of bugs in that all triggers will occur on the supplied
Scheduler. Previously the initial value would trigger synchronously (on the subscribing thread) while subsequent ones trigger on the thread which performed the transaction. The new behavior puts the initial trigger on the same thread as all subsequent triggers and also does not force transactions to block while sending triggers.
- New: Query logs now contain timing information on how long they took to execute. This only covers
the time until a
Cursorwas made available, not object mapping or delivering to subscribers. - Fix: Switch query logging to happen when
Query.runis called, not when a query is triggered. - Fix: Check for subscribing inside a transaction using a more accurate primitive.
- New: Expose
mapToOne,mapToOneOrDefault, andmapToListas static methods onQuery. These mirror the behavior of the methods of the same name onQueryObservablebut can be used later in a stream by passing the returnedOperatorinstances tolift()(e.g.,take(1).lift(Query.mapToOne(..))). - Requires RxJava 1.1.0 or newer.
- New:
executemethod provides the ability to execute arbitrary SQL statements. - New:
executeAndTriggermethod provides the ability to execute arbitrary SQL statements and notifying any queries to update on the specified table. - Fix:
Query.asRowsno longer callsonCompletedwhen the downstream subscriber has unsubscribed.
- New:
mapToOneOrDefaultreplacesmapToOneOrNullfor more flexibility. - Fix: Notifications of table updates as the result of a transaction now occur after the transaction has been applied. Previous the notification would happen during the commit at which time it was invalid to create a new transaction in a subscriber.
- New:
mapToOneandmapToOneOrNulloperators onQueryObservable. These work on queries which return 0 or 1 rows and are a convenience for turning them into a typeTgiven a mapper of typeFunc1<Cursor, T>(the same which can be used formapToList). - Fix: Remove
@WorkerThreadannotations for now. Various combinations of lint, RxJava, and retrolambda can cause false-positives.
- Transactions are now exposed as objects instead of methods. Call
newTransaction()to start a transaction. On theTransactioninstance, callmarkSuccessful()to indicate success andend()to commit or rollback the transaction. TheTransactioninstance implementsCloseableto allow its use in a try-with-resources construct. See thenewTransaction()Javadoc for more information. Queryinstances can now be turned directly into anObservable<T>by callingasRowswith aFunc1<Cursor, T>that maps rows to a typeT. This allows easy filtering and limiting in memory rather than in the query. See theasRowsJavadoc for more information.createQuerynow returns aQueryObservablewhich offers amapToListoperator. This operator also takes aFunc1<Cursor, T>for mapping rows to a typeT, but instead of individual rows it collects all the rows into a list. For large query results or frequently updated tables this can create a lot of objects. See themapToListJavadoc for more information.- New: Nullability,
@CheckResult, and@WorkerThreadannotations on all APIs allow a more useful interaction with lint in consuming projects.
- Fix: Add support for backpressure.
- An
Observable<Query>can now be created from wrapping aContentResolverin order to observe queries from another app's content provider. SqlBriteclass is now a factory for both aBriteDatabase(theSQLiteOpenHelperwrapper) andBriteContentResolver(theContentResolverwrapper).
Initial release.