• Home
  • History
  • Annotate
  • only in /frameworks/support/room/compiler/src/test/data/
History log of /frameworks/support/room/compiler/src/test/data/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
97253f70d5f0bb5d79736629a18718526d67efa5 21-Sep-2017 Yigit Boyar <yboyar@google.com> Merge "Add @Transaction annotation" into oc-mr1-dev
2f4954c4f10e675761a365a26c90a604ffbe3d6e 20-Sep-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Enforcing a NON NULL constraint on the PrimaryKey" into oc-mr1-dev
b3c4d9308e4fd66beca3a7824a5db749ce2aace1 14-Jun-2017 Yuichi Araki <yaraki@google.com> Add @Transaction annotation

@Transaction can be put on methods in abstract Dao classes to make it
run in a transaction.

A non-abstract method is overridden in the derived Dao class and wrapped
in a transaction.

Test: SimpleEntityReadWriteTest, DaoWriterTest
Bug: 66011356
Change-Id: I40ba2c312aa5609ecee950784498a1d811ff5722
aoWriter/input/ComplexDao.java
aoWriter/output/ComplexDao.java
2b4a201ee53be9d5e3995e62c76f83c07a1ddfdd 16-Sep-2017 Yigit Boyar <yboyar@google.com> API changes in SupportSQLiteDatabase

b/65499876:
Moved versions and database error handler into the callback so that
constants things can be separated from runtime values (context, name).

b/65349673:
Moved database error handler inside the Callback, which avoids the
problem the DatabaseErrorHandler gets an SQLiteDatabase instead of
a SupportSQLiteDatabase. It also seems more suitable in the Callback
since it has other lifecycle events like downgrade, open etc.

Bug: 65499876
Bug: 65349673
Test: room tests pass.

Change-Id: I082e15007556e6d9a4239081150db28b55950572
atabasewriter/output/ComplexDatabase.java
540e3498175652abe452d8e0ed1c252e718ddf5a 13-Sep-2017 Florina Muntenescu <florinam@google.com> Enforcing a NON NULL constraint on the PrimaryKey

Intended behaviour:
1. If a key is not autogenerated, but is Primary key or is
part of Primary key we force the developer to add @NonNull annotation
2. if a key is autogenerate, we generate NOT NULL in table spec,
but we don't require @NonNull annotation on the field itself.

Bug: 64292391
Test: EntityProcessorTest, room integration tests

Change-Id: I0b76122680a8f78080a715919e855aa7f414f700
ommon/input/MultiPKeyEntity.java
ef346ae131affbba6345e00d833103acc5743c8a 29-Aug-2017 Chris Craik <ccraik@google.com> Paging API refinements, and package name rework

Bug: 64809611
Test: tests in paging-runtime, paging-common, room-integration-tests

Change-Id: I1e26f130d95b31494f9a0ef734fd87594de9ddd1
ommon/input/LivePagedListProvider.java
2e9d5136685b07ef5bfabcd3936b1eedb5d24e91 25-Aug-2017 Chris Craik <ccraik@google.com> DataSource key rework

Bug: 64809611
Test: tests in paging-runtime, paging-common, room-integration-tests

Test: QueryDataSourceTest, ComplexQueryDataSourceTest, LimitOffsetDataSourceTest, KeyedDataSourceTest
All data sources now have a Key type, so that KeyedDataSource entirely
avoids positions.

Change-Id: I10ea33794621580e54876e422ffc69c3e21f453e
ommon/input/LivePagedListProvider.java
3738847ee36fbb5d5c4786199268a89d3a4681a3 02-Aug-2017 shepshapard <shepshapard@google.com> Added @Generated annotation to generated files in Room when javax.annotation.Generated exists on classpath.

Bug: 35754778
Change-Id: I0c77b622a0e8a4783cc1e045eab1e97ddb735f70
Fixes: 35754778
Test: Modified unit tests pass.
aoWriter/output/ComplexDao.java
aoWriter/output/DeletionDao.java
aoWriter/output/UpdateDao.java
aoWriter/output/WriterDao.java
atabasewriter/output/ComplexDatabase.java
24418e9aafa6ae3128ae47cf7087eda46dae4f5d 18-Aug-2017 Chris Craik <ccraik@google.com> Revert "Revert "Paging refactor to unify list/data source types, and simplify mutability""

bug:64838013

Fixed build breakage.

This reverts commit c051b0691f4363110fb3d62193a114b04a8ef344.

Change-Id: I4fd2442d185b4b107e2db45c402f79ed9948bc38
ommon/input/LiveLazyListProvider.java
ommon/input/LivePagedListProvider.java
c051b0691f4363110fb3d62193a114b04a8ef344 18-Aug-2017 Chris Craik <ccraik@google.com> Revert "Paging refactor to unify list/data source types, and simplify mutability"

bug:64838013 Fix build breakage

This reverts commit 1cb45e73a41f91534febb7e5d799e1f703fb3763.

Change-Id: I88d2c954f48f1c6693ccfc31b3b62a37c5abac9a
ommon/input/LiveLazyListProvider.java
ommon/input/LivePagedListProvider.java
1cb45e73a41f91534febb7e5d799e1f703fb3763 15-Jul-2017 Chris Craik <ccraik@google.com> Paging refactor to unify list/data source types, and simplify mutability

Bug: 64809611
Test: new tests passing

- Unified list type for contiguous data sources - null padding is created at initialization, and
consumed as items are loaded. Infinite unpadded, and counted padded lists use same list type
entirely.

- New list and DataSource type for tiled data sources, which can access data at any location.

- Split data source based on keyed vs tiled based implementations. This massively simplified the
few existing data sources, and allowed us to specialize further, making the trivial test (and
limit-offset) code much simpler (and avoiding code that was extremely prone to off by one errors)

- Added PagedListAdapter, which provides convenience wrapper for the AdapterHelper, saving users a
few extra lines of code.

- Uncountable positioning - rework also has relative data source position stored at initialization
so that countable items can use position, without being required to count their dataset. This
supports cases with simple position IDs, but where you: 1) don't want nulls in the data, 2) don't
care about count/scrollbars, 3) can't easily compute the total number.

- PagedList requires data to initialize - Removes need for weird warmup API, avoids showing a list
of nulls to user in countable case, and unifies initialization codepaths.

- PagedList has a snapshot() method that enables DiffUtil to run safely on a background thread on
immutable data, and snapshot-aware diffing that allows a new list to load content while it's being
used in diffing on a background thread.

Not done:

- Parameterized initialization (both init from key, storing key, passing key when creating LiveData<PagedList>)

Change-Id: I7cb945afe37e68aad44cde45277afd7a27416e52
ommon/input/LiveLazyListProvider.java
ommon/input/LivePagedListProvider.java
b2bfd37e6320e795bffafe24cfdc6a1d1b3da035 21-Jul-2017 Yuichi Araki <yaraki@google.com> NOT NULL constraint by @NonNull

NonNull entity fields automatically have NOT NULL constraint in SQLite.

A field is regarded as NonNull when it is either one of these:
- A primitive type
- Annotated with @android.support.annotation.NonNull
- Annotated with @org.jetbrains.annotations.NotNull

Bug: 62007004
Test: SimpleEntityReadWriteTest, EntityProcessorTest
Change-Id: I1d06a89874e8804cca87736573eb0b81166bbab0
atabasewriter/output/ComplexDatabase.java
a595f18019fa63b75fadc2c9a36f85503ca8b94b 18-Jul-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix @Query without any parameters" into oc-support-26.0-dev
e088306a4368329d3e00b3da0f4682fc37e54cb8 13-Jul-2017 Yuichi Araki <yaraki@google.com> Fix @Query without any parameters

Bug: 63608092
Test: SimpleEntityReadWriteTest and DaoWriterTest
Change-Id: I9998c18ea2f16501ea57925d6e5b0605ba2f946b
aoWriter/input/DeletionDao.java
aoWriter/input/UpdateDao.java
aoWriter/output/DeletionDao.java
aoWriter/output/UpdateDao.java
9fd8e6171bbdc37f5516fe15b2d96f4ae926ef1a 23-Jun-2017 Chris Craik <ccraik@google.com> Initial commit of paging component.

This commit introduces a paging component to enable gradual, lazy
loading from large data sources, including Room queries.

The primary entry points are:

1) CountedDataSource, the base class for defining a countable (i.e.
fixed, known size) source of items, such as a Database query.

2) LazyList, the lazy-loading List-like component which pages content
in on a background thread from a CountedDataSource.

3) LiveLazyListProvider, the class which produces DataSources, and
presents a LiveData<LazyList<T>>.

4) LazyListAdapterHelper, which takes a LiveData<LazyList>, and
presents the data simply to an adapter. It computes differences
between versions with DiffUtil, and signalling updates to the adapter.

Currently, Room only presents a limit-offset query as an easy means to
get a LiveData of a LazyList, but it's possible to write a custom data
source to page in data from keyed (including composite-keyed) queries.

Test: new tests
Change-Id: I415879a032d83786d734c26c429828da3b8bc76a
ommon/input/LiveLazyListProvider.java
aoWriter/input/ComplexDao.java
cf4d34906517d8ced296a96e50339c926a7dfdcd 30-Jun-2017 Yuichi Araki <yaraki@google.com> Add RoomDatabase.Callback

Users can now add Callbacks to RoomDatabase.

Bug: 62699324
Test: DatabaseCallbackTest
Change-Id: I0fa38ba97614e1ad721594d238960b8183e96769
atabasewriter/output/ComplexDatabase.java
aa4decb2298d680bae12333764b3bccd859c76ac 10-Jul-2017 Yigit Boyar <yboyar@google.com> Merge "Revert "Make ComputableLiveData a real LiveData"" into oc-support-26.0-dev
f59164365fb6de9f148b597af5a6e19b3b7c8c2e 10-Jul-2017 Yigit Boyar <yboyar@google.com> Revert "Make ComputableLiveData a real LiveData"

This reverts commit d58f4645f2a8bf29a5e62f7dceceb7b4da9ff337.

Change-Id: I3bd24ed09bdcc63db98a0cdf4f401f2bf682aefe
ommon/input/ComputableLiveData.java
aoWriter/output/ComplexDao.java
97d8e7f3c524b1bc986c9c86f0f92bd8831890a3 10-Jul-2017 Yigit Boyar <yboyar@google.com> Merge "Make ComputableLiveData a real LiveData" into oc-support-26.0-dev
d58f4645f2a8bf29a5e62f7dceceb7b4da9ff337 28-Jun-2017 Yigit Boyar <yboyar@google.com> Make ComputableLiveData a real LiveData

This CL removes the intermediate ComputableLiveData class which
was not a live data :/.

I've also added more tests to ensure that we are handling GC
properly (we were).

Bug: 63513657
Test: LiveDataQueryTest, ComputableLiveDataTest, InvalidationTrackerTest
Change-Id: I9be2330d8009014a1147b6f3ec8aac67b06229ab
ommon/input/ComputableLiveData.java
aoWriter/output/ComplexDao.java
86b3f8d9bd637749668174e0736fe9fbecbcfb09 27-Jun-2017 Yuichi Araki <yaraki@google.com> Multiple Entities in Insert, Update and Delete

Dao can now have @Insert, @Update and @Delete methods with more than one
types of Entities.

Bug: 62682405
Test: SimpleEntityReadWriteTest, *ProcessorTests
Change-Id: Ib2f1afabff237f26d250b3fcf7b2fdf50d01ecff
(cherry picked from commit 77d77afb0cde4df833c6d10f641de2dc81f859b8)
aoWriter/input/DeletionDao.java
aoWriter/input/UpdateDao.java
aoWriter/input/WriterDao.java
aoWriter/output/DeletionDao.java
aoWriter/output/UpdateDao.java
aoWriter/output/WriterDao.java
1d3d9d6121d53a4c11223ba475d8954315952a09 15-Jun-2017 Yigit Boyar <yboyar@google.com> Fix addition code for argument size

This CL fixes a problem in the query writer where, while
summing the argument list counts, we would not specify a
separator which defaults to ','. Now we specify empty
string to avoid adding unwanted characters.

Bug: 62608681
Test: DaoWriterTest
Change-Id: If7a9fac6fa0e61d0730845691eb23579ebd30ba1
aoWriter/input/ComplexDao.java
aoWriter/output/ComplexDao.java
17caba59e1fd850fe1381d7311d23afc4e07cdfb 05-Jun-2017 Yuichi Araki <yaraki@google.com> Allow Dao to have constructor with DB param

This change allows abstract Dao class to have a constructor with a
RoomDatabase parameter. The implementation Dao class will call it with
the approppriate database instance.

Bug: 38488747
Test: DaoWriterTest, DatabaseProcessorTest
Change-Id: I6d7fa98b19a99b7a171983422c882557bde306bc
aoWriter/input/ComplexDao.java
aoWriter/output/ComplexDao.java
2ec1285ef79d4849069efe95cfbac2307d291a47 31-May-2017 Yuichi Araki <yaraki@google.com> InvalidationTracker now passes invalidated tables

This allows developers to observe multiple tables at the same time and
get notified of which table was actually invalidated.

Bug: 38468740
Test: InvalidationTrackerTest, InvalidationTest, RxRoomTest
Change-Id: I6c2a8c36417c4d9b223a03a54ff5183f17974ab2
aoWriter/output/ComplexDao.java
3542101509120586bbae17b1f748f302e1fb82a3 04-May-2017 Yigit Boyar <yboyar@google.com> Don't allow anonymous bind parameters.

Bug: 37990862
Test: existing tests pass
Change-Id: I3db2de89a4f46acf1396af4e1d3793bd2def6aec
aoWriter/input/DeletionDao.java
64db0cc15b78b62a1d44a70fc8b4552e660d952c 17-Apr-2017 Yigit Boyar <yboyar@google.com> Mass package renaming from android.support to android.arch

Bug: 37429162
Test: ./gradlew check passes

Change-Id: I911766254b6a9f957ef90429a1efc01c209d693a
ommon/input/Book.java
ommon/input/ComputableLiveData.java
ommon/input/LiveData.java
ommon/input/MultiPKeyEntity.java
ommon/input/NotAnEntity.java
ommon/input/Rx2Room.java
ommon/input/User.java
aoWriter/input/ComplexDao.java
aoWriter/input/DeletionDao.java
aoWriter/input/UpdateDao.java
aoWriter/input/WriterDao.java
aoWriter/output/ComplexDao.java
aoWriter/output/DeletionDao.java
aoWriter/output/UpdateDao.java
aoWriter/output/WriterDao.java
atabasewriter/input/ComplexDatabase.java
atabasewriter/output/ComplexDatabase.java
f8c3624579d5761a2d34a7199932492d267f5f85 10-Apr-2017 Yigit Boyar <yboyar@google.com> Add support for arg constructors

This CL adds constructor support to Pojo and Entity processors.
We try to map each constructor parameter to a field based on
its name. If there are conflicts, we fail the compilation.
If there are multiple matching constructors, we fail the compilation
and developer can annotate unwanted ones with @Ignore to workaround
the issue.

This CL also prioritizes PojoRowAdapter over EntityRowAdapter since
it is faster and proguard does a good job on shrinking the generated
code.

Bug: 34611719
Bug: 36473441
Bug: 34754519
Test: ConstructorTest, PojoProcessorTest

Change-Id: I70592b129c7dcb9cacfb072b2c63169630eadf9a
aoWriter/output/ComplexDao.java
3c592c4ccbc6052b11443b0fa575052c08fefa55 04-Apr-2017 Yigit Boyar <yboyar@google.com> Room RxJava2 Support, Step 1

This CL adds support for returning Flowable & Publisher from
Room DAO queries. We may introduce an Optional support later
for nullable queries.

I've also changed live data check to use type utils instead of string
matching.

Bug: 37009497
Test: RxRoomTest, RxJava2Test
Change-Id: I00e10efcf7599f3d33cd7e4b6b638b546fb5c1e9
ommon/input/Rx2Room.java
ommon/input/reactivestreams/Publisher.java
ommon/input/rxjava2/Flowable.java
ebdeee2c668f632384a7c9b3a098f0cccf88e7cd 03-Apr-2017 Yigit Boyar <yboyar@google.com> Foreign keys step 3, verification

Adds foreign key verification to the migration helper and
also adds the foreign key information into the exported
bundle.
The conversions between the exported bundle and the
TableInfo is looking unnecssary but keeping it for now
since it gives us the flexibility between the compile time
representation of the schema and runtime representation
(which is limited).

Bug: 36602348
Test: MigrationTest, TableInfoTest
Change-Id: If40fe520c9930493502cddac3e6c747ef26610df
atabasewriter/output/ComplexDatabase.java
3a433f7ddbffa6131883cc3b23fc80edf54add19 26-Mar-2017 Yigit Boyar <yboyar@google.com> Validate migration

This CL adds necessary code to validate database integrity after a
migration. This way, if developer does not implement migration
properly, Room will throw an exception.

Test: TableInfoTest, MigrationTest
Bug: 36602348
Change-Id: Id335875387a740344deb76778c5df6978b0212a5
atabasewriter/output/ComplexDatabase.java
1c3c123c4def03badd03ae39d5aa31f3094b9525 28-Mar-2017 Yigit Boyar <yboyar@google.com> Don't rely on indices in query results

Room used to depend on index of columns in the query result which
may not be reliable especially with migrations. Instead, we
read the column indices using the cursorReady callback. This will
make migration codes easier since they don't need to recreate the
table for added columns.

Bug: 32342709
Test: existing tests pass
Change-Id: Ic93733d847a8de736cd341f312c2f51d090a8359
aoWriter/output/ComplexDao.java
a64756a18111a7312b3fa03b76d13381a8907176 21-Mar-2017 Yigit Boyar <yboyar@google.com> Room Migrations, Step 1

This CL adds ability to specify migration callbacks.
Developer can specify a list of migrations while building the database
and Room will run them. If a path cannot be found, Room will nuke the
database and recreate.

This CL moves the "version" parameter of the database from the
builder into the annotation. This allows us to export the schema
at compile time to be used later.

This CL also introduces a new "testing" package for Room which is
capable of initializing the database based on the exported schema.
This can be used by the developers to create the database in a
previous schema and migrate to the current one.

Test: MigrationTest, BuilderTest, TableInfoTest
Bug: 36602348
Change-Id: I7d543b20410b14ff61ef1b433c38c44009c86e8d
atabasewriter/input/ComplexDatabase.java
atabasewriter/output/ComplexDatabase.java
fa3905934508aa143d899cb9b62b3b074748c9e9 06-Mar-2017 Yigit Boyar <yboyar@google.com> Verify database after opened

Room now keeps an identity hash on the database and checks it when database
is open to ensure that the schema matches the current one. If not, developer
probably forgot to update the version number so it crashes.

Bug: 35804916
Test: IdentityDetectionTest.java
Change-Id: I441cbb3e78d88874406806af6c36917d1bf0142c
atabasewriter/output/ComplexDatabase.java
2c6462f129bf43965ed8b054b026f6a28fe6fd8f 23-Feb-2017 Yigit Boyar <yboyar@google.com> Primary Key improvements

This CL changes @PrimaryKey sytax to disallow multiple fields with
@PrimaryKey annotations. Instead, it enforces using
@Entity#primaryKeys to declare composite primary keys.

This CL also fixes the inheritance rules around PrimaryKeys such that
we'll inherit primary key from super Entity / Pojo if the Entity itself
does not declare any primary keys. If the entity declares a primary
key, the parent key is dropped with a NOTE level log.

Bug: 35706557
Test: EntityProcessorTest#primaryKey*, PrimaryKeyTest.kt
Test: SQLiteOpenHelperWriterTest.kt
Change-Id: Ifcfccf29da21395586e539d0f9b130c7537e5384
ommon/input/MultiPKeyEntity.java
74b28faea4bcc4b7fab113a61a066d22dfae7258 15-Feb-2017 Yigit Boyar <yboyar@google.com> @Update annotation

This CL adds support for @Update annotation in @Dao methods.
It has the same semantics as a deletion methods so I've
moved some functionality into shared functions when feasible.

Bug: 32342709
Test: DaoWriter#updateDao, UpdateMethodProcessorTest.kt
Test: SimpleEntityReadWriteTest.java
Change-Id: I86866b82f9114152d3c9eb2fdc4eefa981be1bb0
aoWriter/input/UpdateDao.java
aoWriter/output/UpdateDao.java
34e95e59b90e821de3621e5e7e6c5a58dbb5891a 17-Feb-2017 Yigit Boyar <yboyar@google.com> Fix column name in entitiy parsers

This CL fixes a bug in Entitiy Cursor generic reader which was
using field name instead of field's column name.

Bug: 35442740
Test: SimpleEntityReadWriteTest#renamedField
Change-Id: Id2fe4dc74e10cd298f1141b5895bb2ee00ac4b4f
aoWriter/output/ComplexDao.java
333b4b5e49c48adf7fb928d445b6f7f276b54a02 15-Feb-2017 Yigit Boyar <yboyar@google.com> Move onConflict strategy to its own class

This moves on conflict strategy to its own class in preparation
for @Upsert and @Update support.

Test: existing tests pass
Bug: 34502968
Change-Id: I34d18a9b19f090b97d4312d9f87f67abe978d1d1
aoWriter/input/WriterDao.java
275e7088223c097c1a2df718455bede42bc9efed 02-Feb-2017 Yigit Boyar <yboyar@google.com> TypeConverters

Tihs CL introduces user defined type converters, which are simple
methods annotated with @TypeConverter.

Each type converter is a custom method that receives 1 parameter
and returns 1 value. The container class for the converter must be
passed into a @TypeConverters annotation to be picked up.
Developer can define these in multiple places depending on the scope
they want to use it.

With this CL, I also migrated @ColumnName annotation into @ColumnInfo
annotation so that we can specify more values. This CL introduces
type affinity field in ColumnInfo. Developers can now specify type
affinity to help the resolution logic to pick the right converter.

Bug: 34610784
Bug: 32342709
Test: CustomConverterProcessorTest.kt, FieldProcessorTest.kt
Test: CustomTypeConverterResolutionTest.kt
Change-Id: I117e4a194e8c93bee58f06a43d688ae04360b08e
ommon/input/User.java
aoWriter/output/ComplexDao.java
645abf12d5a13dae5c2271cedd0563a580871a2b 03-Feb-2017 Yigit Boyar <yboyar@google.com> Enforce class writer in CodeGenScope

It is a common requirement for code generators to re-use fields but they
don't have any access to the TypeSpec nor they can communicate w/ other
code generators.

This CL enforces having a ClassWriter in each CodeGenScope and now the
ClassWriter has 2 methods to add shared fields / methods.
These methods have unique identifiers so that we can carefully re-use
them if they match.

Bug: 32342709
Test: existing tests pass
Change-Id: I47d0966fd330ac2fcde7e924c145471aa1c20cbd
aoWriter/output/DeletionDao.java
13a2048db98b1cc2dbd1692b73b794527975a446 26-Jan-2017 Yigit Boyar <yboyar@google.com> POJO Support

This CL adds ability to return arbitrary POJOs from query results
as long as we match the columns of the result into the pojo.

If the pojo has unused fields or if it ignores some columns from
the result, we show a warning. This warning is listed in
RoomWarnings class and can be disabled via SuppressWarnings.

If SQLVerification is disabled, POJO support does not work.

If the return type is an Entity, we still prefer the entity
converter. This may change in the future.

When converting cursor into POJO, the code is inlined. This
is simpler and avoids the cursor field lookup (because we know
indices ahead of time). This may get expensive if same pojo
is used in multiple places. In the future, we may prefer
creating converters for commonly used pojos.

Bug: 33463891
Test: QueryMethodProcessorTest.kt, PojoTest.java, LiveDataQueryTest.java
Change-Id: Ib82f35d26f839c568e7137c39d4843a9854b20b1
aoWriter/input/ComplexDao.java
aoWriter/output/ComplexDao.java
88865f77c35657a2bc545a718ca16a648fc8b62e 24-Jan-2017 Yigit Boyar <yboyar@google.com> Database Verification

This CL adds logic to verify @Query sql's at compile time.
This is done by creating an in-memory version of the database
during compile time and preparing queries against it.

This is an optional process that developers can disable via
SkipQueryVerification since there is always a chance that we
won't be able to find the sqlite on the host machine. To minimize
the risk, we are shipping xerial with the compiler.
SkipQueryVerification might be necessary if the developer modifies
the database directly.

Right now, we don't use this information besides making sure
query compiles. In followup CLs, we'll use this information
to validate return types and also allow arbitrary java classes
as return types (fi their fields match the fields in the response).

Bug: 33463891
Test: DatabaseVerifierTest
Change-Id: I9667a3bba15a54f25bbe7795de02eaeb435900f9
aoWriter/input/ComplexDao.java
aoWriter/output/ComplexDao.java
b030dcb5b7a62854c0bfe85bf04eaf60caeb83bb 20-Jan-2017 Yigit Boyar <yboyar@google.com> Bind Cursor queries in a type safe API

The rawQuery API in SQLiteDatabase class expects all bind arguments
as Strings. Even though this usually works fine for other types due
to SQLite's type affinity logic, it fails in some cases.

To avoid that, this CL replaces the usage of rawQuery with a new
class called SupportSQLQuery which has a callback to bind items
to a query using the prepared statement.

There is no public API to achieve this so this CL adds a new method
to SupportSQLiteDatabase that accepts SupportSQLiteQuery.
In the framework version, this method is implemented using a
CursorFactory.

This callback is not necessarily instantly invoked so to avoid
the risk of binding to wrong values (because method parameters
may change after the call), the SupportSQLiteStatement is prepared
instantly. For this reason, we have a pooled RoomSQLiteStatement
class that implements the SupportSQLiteProgram API and can rebound
its parameters into another SupportSQLiteProgram. In queries, we
instantly populate it and it can be re-run any later time.
This implementation also avoids creating inner classes for each
query.

Bug: 32342709
Bug: 34503410
Test: RoomSQLiteQueryTest, QueryWriterTest, DaoWriterTest
Change-Id: Id74ba3e02d8de1f7df839249327b3baf933f5f84
aoWriter/output/ComplexDao.java
846dfcf52e22de6d912f8ece05ff939c2c9bd154 17-Jan-2017 Yigit Boyar <yboyar@google.com> LiveDataQuery

This CL adds support for returning LiveData<T> from select queries
in DAO classes.

Rather than extending ResultAdapter to handle this, I've created
a new class called ResultBinder which binds the sql and args with
the ResultAdapter. This would be the place for Rx etc to hook
to implement their observability.

Bug: 32342709
Test: LifeDataQueryTest
Change-Id: I44c7d0571e3d92df5d07fb3802791fc793bf5617
ommon/input/ComputableLiveData.java
ommon/input/LiveData.java
aoWriter/input/ComplexDao.java
aoWriter/output/ComplexDao.java
aoWriter/output/DeletionDao.java
34e5031083f735db3a395b0f6aa430880b072d71 14-Jan-2017 Yigit Boyar <yboyar@google.com> Database invalidation tracking

This CL introduces updated table tracking via sqlite triggers.

There is a new InvalidationTracker class, which creates a version
table in memory that keeps a version for each table. It also
creates triggers for each table and these triggers update the
version table when observed table changes.

When a transaction is committed, we trigger the InvalidationTracker
to refresh itself. This covers all queries that go through Room
but if someone grabs the db and runs a query directly, it wont
work. To support them, there is a public refresh method in the
InvalidationTracker. We may also work around it by wrapping the
SupportSQLiteDatabase.

In a followup CL, I'll introduce an implementataion of
LiveData<T> that observes this table automatically.

Bug: 32342709
Test: InvalidationTrackerTest
Change-Id: I9d0a0cc9dc537200f3fd3cd229df9bfeaf52b56d
aoWriter/output/DeletionDao.java
atabasewriter/output/ComplexDatabase.java
3db6d309415576ef0080c29705dc30496636a986 30-Dec-2016 Yigit Boyar <yboyar@google.com> Add support for Delete queries in @Query annotations

This CL adds support for runinng DELETE queries in
@Query methods.

If the @Query method has predefined number of bind args,
we create a prepared statement and re-use it. If it
has variable number of args, we recreate the query every
time it is run.

Bug: 32342709
Test: SqlParserTest, SimpleEntityReadWriteTest, QueryMethodProcessorTest
Change-Id: I8d9ad83e36e1eed4ddd5e2d714ffb6cdd9881034
aoWriter/input/DeletionDao.java
aoWriter/output/DeletionDao.java
aoWriter/output/WriterDao.java
958df7dd95c2cecf93cacef6998a4d7e8d39b7ef 28-Dec-2016 Yigit Boyar <yboyar@google.com> @Delete support

This CL adds support for abstract methods in DAO annoated with
@Delete.

It is fairly similar to Insert but there are subtle changes so
they share only limited number of classes. I've decided to name
these methods ShortcutMethods (since they are shortcuts to writing
SQL). Suggestions are welcome.

There will also be support for @Update but the CL is getting big
so i decided to spare it for another CL.

Bug: 32342709
Test: DaoWriterTest, SimpleEntityReadWriteTest
Test: DeletionMethodProcessorTest
Change-Id: Ifbf69067b014f1ae5349567a74b4d3f9efb846c7
ommon/input/MultiPKeyEntity.java
aoWriter/input/DeletionDao.java
aoWriter/output/DeletionDao.java
059b497bb099c867fb65e62047975ffbc41475f4 16-Dec-2016 Yigit Boyar <yboyar@google.com> Database Builder

This CL moves database creation from constructor to builder pattern.
This avoids ugly constructor override in Database classes and provides
flexibility for future changes in the database construction.

Bug: 32342709
Test: BuilderTest.java
Change-Id: I95de0b47fdd0e32045b8e84c07b997dff6a211c4
atabasewriter/input/ComplexDatabase.java
atabasewriter/output/ComplexDatabase.java
5ce90e9725b8c9e8fdcef114694d6984a0ef3141 10-Dec-2016 Yigit Boyar <yboyar@google.com> RoomProcessor and Integration test

This CL puts together the very first working version :').

Bug: 32342709
Test: SimpleEntityReadWriteTest.java, DatabaseWriterTest.kt
Change-Id: I7aa449f92b40aac5b682dccc17d276a4e349115b
aoWriter/output/WriterDao.java
atabasewriter/input/ComplexDatabase.java
atabasewriter/output/ComplexDatabase.java
c678b3a4eebc102a1a3b5923c5e07478c0eecae3 10-Dec-2016 Yigit Boyar <yboyar@google.com> Entity schema generation.

This CL adds ability to create database schema from Entity classes.

Bug: 32342709
Test: DatabaseWriterTest.kt, SQLiteOpenHelperWriterTest.kt
Change-Id: I13a5d17eabadd2647aa72d24ae45bf7345e83e10
ommon/input/User.java
aoWriter/output/WriterDao.java
atabasewriter/output/ComplexDatabase.java
d72e20e472815b7d0918e0d309cee48a71c7988b 09-Dec-2016 Yigit Boyar <yboyar@google.com> Db Writer initial code

This CL creates the database writer and prepares RoomDatabase
for actual implementation.

This is just the skeleton, database creation will happen
in another CL.

Bug: 32342709
Test: DatabaseWriter.kt
Change-Id: I7ce7b9c938c7ba196c8d0b6fc5f08d76e2001696
atabasewriter/input/ComplexDatabase.java
atabasewriter/output/ComplexDatabase.java
291985054e698c918df1c735d1042b63b9e97219 09-Dec-2016 Yigit Boyar <yboyar@google.com> Enforce base class for classes annotated with RoomDatabase

Also renamed support db classes to match the framework's naming.

Bug: 32342709
Test: DatabaseProcessorTest
Change-Id: I588d8ddf42b3c91c5b709090659c56ce04a576b8
aoWriter/output/WriterDao.java
4f0db7db556b473393dfc31bba5ea67def574877 06-Dec-2016 Yigit Boyar <yboyar@google.com> Insertion

This CL adds basic support for inserting data into database.
We allow T, T[], List<T>, Set<T> as inputs.
This CL only supports void return type but support for different
return types (e.g. rowId, primaryKey etc) is coming soon.

This also requires all entity types per method to be the same.
We'll support different types which should make it easier to
insert things in batches (and using transactions).

Bug: 32342709
Test: DaoWriterTest, DaoProcessorTest, InsertionMethodProcessorTest
Change-Id: Icd17b59df75beeb2e89baa2a4ae0acbb3e8de573
ommon/input/Book.java
ommon/input/NotAnEntity.java
ommon/input/User.java
aoWriter/input/WriterDao.java
aoWriter/output/WriterDao.java
efaf86afac3163868eda7f91a1c04e3f6e6d7520 03-Dec-2016 Yigit Boyar <yboyar@google.com> Query result adapters

This CL introduces the mecnism to generate the code for a @Query.

I've also introduced a db package which abstracts all communication
with the SqliteDatabase. This will grow to allow people to swap
the underlying sqlite implementation.

Bug: 32342709
Bug: 30355996
Test: DaoWriterTest.kt, EntityCursorConverterWriterTest.kt
Change-Id: I4962ebd3f095839adf00e36ddd1588df7b4ac9c1
GNORE_CHECKSTYLE
aoWriter/input/ComplexDao.java
aoWriter/output/ComplexDao.java