Refactor DaoWriterTest to output generated sources test assets
Also perform a one-time format in the generated output files.
Test: DaoWriterTest
Change-Id: Ia0f68d720d8e912f18acfdf7a490e7d605f97f24
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/writer/DaoWriterTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/writer/DaoWriterTest.kt
index de81792..ca06c0c 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/writer/DaoWriterTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/writer/DaoWriterTest.kt
@@ -31,6 +31,7 @@
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
+import writeTestSource
@RunWith(JUnit4::class)
class DaoWriterTest {
@@ -44,18 +45,9 @@
loadTestSource(
fileName = "daoWriter/input/ComplexDao.java",
qName = "foo.bar.ComplexDao"
- )
- ) {
- val backendFolder = backendFolder(it)
- it.assertCompilationResult {
- generatedSource(
- loadTestSource(
- fileName = "daoWriter/output/$backendFolder/ComplexDao.java",
- qName = "foo.bar.ComplexDao_Impl"
- )
- )
- }
- }
+ ),
+ outputFileName = "ComplexDao.java"
+ )
}
@Test
@@ -75,18 +67,9 @@
loadTestSource(
fileName = "daoWriter/input/WriterDao.java",
qName = "foo.bar.WriterDao"
- )
- ) {
- val backendFolder = backendFolder(it)
- it.assertCompilationResult {
- generatedSource(
- loadTestSource(
- fileName = "daoWriter/output/$backendFolder/WriterDao.java",
- qName = "foo.bar.WriterDao_Impl"
- )
- )
- }
- }
+ ),
+ outputFileName = "WriterDao.java"
+ )
}
@Test
@@ -95,18 +78,9 @@
loadTestSource(
fileName = "daoWriter/input/DeletionDao.java",
qName = "foo.bar.DeletionDao"
- )
- ) {
- val backendFolder = backendFolder(it)
- it.assertCompilationResult {
- generatedSource(
- loadTestSource(
- fileName = "daoWriter/output/$backendFolder/DeletionDao.java",
- qName = "foo.bar.DeletionDao_Impl"
- )
- )
- }
- }
+ ),
+ outputFileName = "DeletionDao.java"
+ )
}
@Test
@@ -115,18 +89,9 @@
loadTestSource(
fileName = "daoWriter/input/UpdateDao.java",
qName = "foo.bar.UpdateDao"
- )
- ) {
- val backendFolder = backendFolder(it)
- it.assertCompilationResult {
- generatedSource(
- loadTestSource(
- fileName = "daoWriter/output/$backendFolder/UpdateDao.java",
- qName = "foo.bar.UpdateDao_Impl"
- )
- )
- }
- }
+ ),
+ outputFileName = "UpdateDao.java"
+ )
}
@Test
@@ -135,23 +100,15 @@
loadTestSource(
fileName = "daoWriter/input/UpsertDao.java",
qName = "foo.bar.UpsertDao"
- )
- ) {
- val backendFolder = backendFolder(it)
- it.assertCompilationResult {
- generatedSource(
- loadTestSource(
- fileName = "daoWriter/output/$backendFolder/UpsertDao.java",
- qName = "foo.bar.UpsertDao_Impl"
- )
- )
- }
- }
+ ),
+ outputFileName = "UpsertDao.java"
+ )
}
private fun singleDao(
vararg inputs: Source,
- handler: (XTestInvocation) -> Unit
+ outputFileName: String,
+ handler: (XTestInvocation) -> Unit = { }
) {
val sources = listOf(
COMMON.USER, COMMON.MULTI_PKEY_ENTITY, COMMON.BOOK,
@@ -188,13 +145,33 @@
val parsedDao = parser.process()
DaoWriter(parsedDao, db, CodeLanguage.JAVA)
.write(invocation.processingEnv)
+ val outputSubFolder = outputFolder(invocation)
+ invocation.assertCompilationResult {
+ val expectedFilePath = "daoWriter/output/$outputSubFolder/$outputFileName"
+ val expectedSrc = loadTestSource(
+ fileName = expectedFilePath,
+ qName = parsedDao.implTypeName.canonicalName
+ )
+ // Set ROOM_TEST_WRITE_SRCS env variable to make tests write expected sources,
+ // handy for big sweeping code gen changes. ;)
+ if (System.getenv("ROOM_TEST_WRITE_SRCS") != null) {
+ writeTestSource(
+ checkNotNull(this.findGeneratedSource(expectedSrc.relativePath)) {
+ "Couldn't find gen src: $expectedSrc"
+ },
+ expectedFilePath
+ )
+ }
+ generatedSource(expectedSrc)
+ }
}
- // we could call handler inside the if block but if something happens and we cannot
- // find the dao, test will never assert on generated code.
handler(invocation)
}
}
- private fun backendFolder(invocation: XTestInvocation) =
- invocation.processingEnv.backend.name.lowercase()
+ private fun outputFolder(
+ invocation: XTestInvocation,
+ ): String {
+ return invocation.processingEnv.backend.name.lowercase()
+ }
}
diff --git a/room/room-compiler/src/test/test-data/daoWriter/output/javac/ComplexDao.java b/room/room-compiler/src/test/test-data/daoWriter/output/javac/ComplexDao.java
index b29e9ef..4190e31 100644
--- a/room/room-compiler/src/test/test-data/daoWriter/output/javac/ComplexDao.java
+++ b/room/room-compiler/src/test/test-data/daoWriter/output/javac/ComplexDao.java
@@ -33,727 +33,727 @@
@Generated("androidx.room.RoomProcessor")
@SuppressWarnings({"unchecked", "deprecation", "removal"})
public final class ComplexDao_Impl extends ComplexDao {
- private final RoomDatabase __db;
+ private final RoomDatabase __db;
- public ComplexDao_Impl(final ComplexDatabase __db) {
- super(__db);
- this.__db = __db;
- }
+ public ComplexDao_Impl(final ComplexDatabase __db) {
+ super(__db);
+ this.__db = __db;
+ }
- @Override
- public boolean transactionMethod(final int i, final String s, final long l) {
- return DBUtil.performBlocking(__db, false, true, (_connection) -> {
- return ComplexDao_Impl.super.transactionMethod(i, s, l);
+ @Override
+ public boolean transactionMethod(final int i, final String s, final long l) {
+ return DBUtil.performBlocking(__db, false, true, (_connection) -> {
+ return ComplexDao_Impl.super.transactionMethod(i, s, l);
});
- }
+ }
- @Override
- public List<ComplexDao.FullName> fullNames(final int id) {
- final String _sql = "SELECT name || lastName as fullName, uid as id FROM user where uid = ?";
- return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<ComplexDao.FullName>>() {
- @Override
- @NonNull
- public List<ComplexDao.FullName> invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- int _argIndex = 1;
- _stmt.bindLong(_argIndex, id);
- final int _cursorIndexOfFullName = 0;
- final int _cursorIndexOfId = 1;
- final List<ComplexDao.FullName> _result = new ArrayList<ComplexDao.FullName>();
- while (_stmt.step()) {
- final ComplexDao.FullName _item;
- _item = new ComplexDao.FullName();
- if (_stmt.isNull(_cursorIndexOfFullName)) {
- _item.fullName = null;
- } else {
- _item.fullName = _stmt.getText(_cursorIndexOfFullName);
- }
- _item.id = (int) (_stmt.getLong(_cursorIndexOfId));
- _result.add(_item);
- }
- return _result;
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @Override
- public User getById(final int id) {
- final String _sql = "SELECT * FROM user where uid = ?";
- return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, User>() {
- @Override
- @NonNull
- public User invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- int _argIndex = 1;
- _stmt.bindLong(_argIndex, id);
- final int _cursorIndexOfUid = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "uid");
- final int _cursorIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name");
- final int _cursorIndexOfLastName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "lastName");
- final int _cursorIndexOfAge = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "ageColumn");
- final User _result;
- if (_stmt.step()) {
- _result = new User();
- _result.uid = (int) (_stmt.getLong(_cursorIndexOfUid));
- if (_stmt.isNull(_cursorIndexOfName)) {
- _result.name = null;
- } else {
- _result.name = _stmt.getText(_cursorIndexOfName);
- }
- final String _tmpLastName;
- if (_stmt.isNull(_cursorIndexOfLastName)) {
- _tmpLastName = null;
- } else {
- _tmpLastName = _stmt.getText(_cursorIndexOfLastName);
- }
- _result.setLastName(_tmpLastName);
- _result.age = (int) (_stmt.getLong(_cursorIndexOfAge));
- } else {
- _result = null;
- }
- return _result;
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @Override
- public User findByName(final String name, final String lastName) {
- final String _sql = "SELECT * FROM user where name LIKE ? AND lastName LIKE ?";
- return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, User>() {
- @Override
- @NonNull
- public User invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- int _argIndex = 1;
- if (name == null) {
- _stmt.bindNull(_argIndex);
- } else {
- _stmt.bindText(_argIndex, name);
- }
- _argIndex = 2;
- if (lastName == null) {
- _stmt.bindNull(_argIndex);
- } else {
- _stmt.bindText(_argIndex, lastName);
- }
- final int _cursorIndexOfUid = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "uid");
- final int _cursorIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name");
- final int _cursorIndexOfLastName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "lastName");
- final int _cursorIndexOfAge = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "ageColumn");
- final User _result;
- if (_stmt.step()) {
- _result = new User();
- _result.uid = (int) (_stmt.getLong(_cursorIndexOfUid));
- if (_stmt.isNull(_cursorIndexOfName)) {
- _result.name = null;
- } else {
- _result.name = _stmt.getText(_cursorIndexOfName);
- }
- final String _tmpLastName;
- if (_stmt.isNull(_cursorIndexOfLastName)) {
- _tmpLastName = null;
- } else {
- _tmpLastName = _stmt.getText(_cursorIndexOfLastName);
- }
- _result.setLastName(_tmpLastName);
- _result.age = (int) (_stmt.getLong(_cursorIndexOfAge));
- } else {
- _result = null;
- }
- return _result;
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @Override
- public List<User> loadAllByIds(final int... ids) {
- final StringBuilder _stringBuilder = new StringBuilder();
- _stringBuilder.append("SELECT * FROM user where uid IN (");
- final int _inputSize = ids == null ? 1 : ids.length;
- StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
- _stringBuilder.append(")");
- final String _sql = _stringBuilder.toString();
- return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<User>>() {
- @Override
- @NonNull
- public List<User> invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- int _argIndex = 1;
- if (ids == null) {
- _stmt.bindNull(_argIndex);
- } else {
- for (int _item : ids) {
- _stmt.bindLong(_argIndex, _item);
- _argIndex++;
- }
- }
- final int _cursorIndexOfUid = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "uid");
- final int _cursorIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name");
- final int _cursorIndexOfLastName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "lastName");
- final int _cursorIndexOfAge = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "ageColumn");
- final List<User> _result = new ArrayList<User>();
- while (_stmt.step()) {
- final User _item_1;
- _item_1 = new User();
- _item_1.uid = (int) (_stmt.getLong(_cursorIndexOfUid));
- if (_stmt.isNull(_cursorIndexOfName)) {
- _item_1.name = null;
- } else {
- _item_1.name = _stmt.getText(_cursorIndexOfName);
- }
- final String _tmpLastName;
- if (_stmt.isNull(_cursorIndexOfLastName)) {
- _tmpLastName = null;
- } else {
- _tmpLastName = _stmt.getText(_cursorIndexOfLastName);
- }
- _item_1.setLastName(_tmpLastName);
- _item_1.age = (int) (_stmt.getLong(_cursorIndexOfAge));
- _result.add(_item_1);
- }
- return _result;
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @Override
- int getAge(final int id) {
- final String _sql = "SELECT ageColumn FROM user where uid = ?";
- return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- int _argIndex = 1;
- _stmt.bindLong(_argIndex, id);
- final int _result;
- if (_stmt.step()) {
- _result = (int) (_stmt.getLong(0));
- } else {
- _result = 0;
- }
- return _result;
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @Override
- public int[] getAllAges(final int... ids) {
- final StringBuilder _stringBuilder = new StringBuilder();
- _stringBuilder.append("SELECT ageColumn FROM user where uid IN(");
- final int _inputSize = ids == null ? 1 : ids.length;
- StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
- _stringBuilder.append(")");
- final String _sql = _stringBuilder.toString();
- return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, int[]>() {
- @Override
- @NonNull
- public int[] invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- int _argIndex = 1;
- if (ids == null) {
- _stmt.bindNull(_argIndex);
- } else {
- for (int _item : ids) {
- _stmt.bindLong(_argIndex, _item);
- _argIndex++;
- }
- }
- final List<Integer> _listResult = new ArrayList<Integer>();
- while (_stmt.step()) {
- final Integer _item_1;
- if (_stmt.isNull(0)) {
- _item_1 = null;
- } else {
- _item_1 = (int) (_stmt.getLong(0));
- }
- _listResult.add(_item_1);
- }
- final int[] _tmpArrayResult = new int[_listResult.size()];
- int _index = 0;
- for (int _listItem : _listResult) {
- _tmpArrayResult[_index] = _listItem;
- _index++;
- }
- final int[] _result = _tmpArrayResult;
- return _result;
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @Override
- public List<Integer> getAllAgesAsList(final List<Integer> ids) {
- final StringBuilder _stringBuilder = new StringBuilder();
- _stringBuilder.append("SELECT ageColumn FROM user where uid IN(");
- final int _inputSize = ids == null ? 1 : ids.size();
- StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
- _stringBuilder.append(")");
- final String _sql = _stringBuilder.toString();
- return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<Integer>>() {
- @Override
- @NonNull
- public List<Integer> invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- int _argIndex = 1;
- if (ids == null) {
- _stmt.bindNull(_argIndex);
- } else {
- for (Integer _item : ids) {
- if (_item == null) {
- _stmt.bindNull(_argIndex);
- } else {
- _stmt.bindLong(_argIndex, _item);
- }
- _argIndex++;
- }
- }
- final List<Integer> _result = new ArrayList<Integer>();
- while (_stmt.step()) {
- final Integer _item_1;
- if (_stmt.isNull(0)) {
- _item_1 = null;
- } else {
- _item_1 = (int) (_stmt.getLong(0));
- }
- _result.add(_item_1);
- }
- return _result;
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @Override
- public List<Integer> getAllAgesAsList(final List<Integer> ids1, final int[] ids2,
- final int... ids3) {
- final StringBuilder _stringBuilder = new StringBuilder();
- _stringBuilder.append("SELECT ageColumn FROM user where uid IN(");
- final int _inputSize = ids1 == null ? 1 : ids1.size();
- StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
- _stringBuilder.append(") OR uid IN (");
- final int _inputSize_1 = ids2 == null ? 1 : ids2.length;
- StringUtil.appendPlaceholders(_stringBuilder, _inputSize_1);
- _stringBuilder.append(") OR uid IN (");
- final int _inputSize_2 = ids3 == null ? 1 : ids3.length;
- StringUtil.appendPlaceholders(_stringBuilder, _inputSize_2);
- _stringBuilder.append(")");
- final String _sql = _stringBuilder.toString();
- return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<Integer>>() {
- @Override
- @NonNull
- public List<Integer> invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- int _argIndex = 1;
- if (ids1 == null) {
- _stmt.bindNull(_argIndex);
- } else {
- for (Integer _item : ids1) {
- if (_item == null) {
- _stmt.bindNull(_argIndex);
- } else {
- _stmt.bindLong(_argIndex, _item);
- }
- _argIndex++;
- }
- }
- _argIndex = 1 + _inputSize;
- if (ids2 == null) {
- _stmt.bindNull(_argIndex);
- } else {
- for (int _item_1 : ids2) {
- _stmt.bindLong(_argIndex, _item_1);
- _argIndex++;
- }
- }
- _argIndex = 1 + _inputSize + _inputSize_1;
- if (ids3 == null) {
- _stmt.bindNull(_argIndex);
- } else {
- for (int _item_2 : ids3) {
- _stmt.bindLong(_argIndex, _item_2);
- _argIndex++;
- }
- }
- final List<Integer> _result = new ArrayList<Integer>();
- while (_stmt.step()) {
- final Integer _item_3;
- if (_stmt.isNull(0)) {
- _item_3 = null;
- } else {
- _item_3 = (int) (_stmt.getLong(0));
- }
- _result.add(_item_3);
- }
- return _result;
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @Override
- public LiveData<User> getByIdLive(final int id) {
- final String _sql = "SELECT * FROM user where uid = ?";
- final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 1);
- int _argIndex = 1;
- _statement.bindLong(_argIndex, id);
- return __db.getInvalidationTracker().createLiveData(new String[] {"user"}, false, new Callable<User>() {
- @Override
- @Nullable
- public User call() throws Exception {
- final Cursor _cursor = DBUtil.query(__db, _statement, false, null);
- try {
- final int _cursorIndexOfUid = CursorUtil.getColumnIndexOrThrow(_cursor, "uid");
- final int _cursorIndexOfName = CursorUtil.getColumnIndexOrThrow(_cursor, "name");
- final int _cursorIndexOfLastName = CursorUtil.getColumnIndexOrThrow(_cursor, "lastName");
- final int _cursorIndexOfAge = CursorUtil.getColumnIndexOrThrow(_cursor, "ageColumn");
- final User _result;
- if (_cursor.moveToFirst()) {
- _result = new User();
- _result.uid = _cursor.getInt(_cursorIndexOfUid);
- if (_cursor.isNull(_cursorIndexOfName)) {
- _result.name = null;
- } else {
- _result.name = _cursor.getString(_cursorIndexOfName);
- }
- final String _tmpLastName;
- if (_cursor.isNull(_cursorIndexOfLastName)) {
- _tmpLastName = null;
- } else {
- _tmpLastName = _cursor.getString(_cursorIndexOfLastName);
- }
- _result.setLastName(_tmpLastName);
- _result.age = _cursor.getInt(_cursorIndexOfAge);
- } else {
- _result = null;
- }
- return _result;
- } finally {
- _cursor.close();
- }
- }
-
- @Override
- protected void finalize() {
- _statement.release();
- }
- });
- }
-
- @Override
- public LiveData<List<User>> loadUsersByIdsLive(final int... ids) {
- final StringBuilder _stringBuilder = new StringBuilder();
- _stringBuilder.append("SELECT * FROM user where uid IN (");
- final int _inputSize = ids == null ? 1 : ids.length;
- StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
- _stringBuilder.append(")");
- final String _sql = _stringBuilder.toString();
- final int _argCount = 0 + _inputSize;
- final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, _argCount);
- int _argIndex = 1;
- if (ids == null) {
- _statement.bindNull(_argIndex);
- } else {
- for (int _item : ids) {
- _statement.bindLong(_argIndex, _item);
- _argIndex++;
- }
- }
- return __db.getInvalidationTracker().createLiveData(new String[] {"user"}, false, new Callable<List<User>>() {
- @Override
- @Nullable
- public List<User> call() throws Exception {
- final Cursor _cursor = DBUtil.query(__db, _statement, false, null);
- try {
- final int _cursorIndexOfUid = CursorUtil.getColumnIndexOrThrow(_cursor, "uid");
- final int _cursorIndexOfName = CursorUtil.getColumnIndexOrThrow(_cursor, "name");
- final int _cursorIndexOfLastName = CursorUtil.getColumnIndexOrThrow(_cursor, "lastName");
- final int _cursorIndexOfAge = CursorUtil.getColumnIndexOrThrow(_cursor, "ageColumn");
- final List<User> _result = new ArrayList<User>();
- while (_cursor.moveToNext()) {
- final User _item_1;
- _item_1 = new User();
- _item_1.uid = _cursor.getInt(_cursorIndexOfUid);
- if (_cursor.isNull(_cursorIndexOfName)) {
- _item_1.name = null;
- } else {
- _item_1.name = _cursor.getString(_cursorIndexOfName);
- }
- final String _tmpLastName;
- if (_cursor.isNull(_cursorIndexOfLastName)) {
- _tmpLastName = null;
- } else {
- _tmpLastName = _cursor.getString(_cursorIndexOfLastName);
- }
- _item_1.setLastName(_tmpLastName);
- _item_1.age = _cursor.getInt(_cursorIndexOfAge);
- _result.add(_item_1);
- }
- return _result;
- } finally {
- _cursor.close();
- }
- }
-
- @Override
- protected void finalize() {
- _statement.release();
- }
- });
- }
-
- @Override
- public List<Child1> getChild1List() {
- final String _sql = "SELECT * FROM Child1";
- return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<Child1>>() {
- @Override
- @NonNull
- public List<Child1> invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- final int _cursorIndexOfId = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "id");
- final int _cursorIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name");
- final int _cursorIndexOfSerial = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "serial");
- final int _cursorIndexOfCode = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "code");
- final List<Child1> _result = new ArrayList<Child1>();
- while (_stmt.step()) {
- final Child1 _item;
- final int _tmpId;
- _tmpId = (int) (_stmt.getLong(_cursorIndexOfId));
- final String _tmpName;
- if (_stmt.isNull(_cursorIndexOfName)) {
- _tmpName = null;
- } else {
- _tmpName = _stmt.getText(_cursorIndexOfName);
- }
- final Info _tmpInfo;
- if (!(_stmt.isNull(_cursorIndexOfSerial) && _stmt.isNull(_cursorIndexOfCode))) {
- _tmpInfo = new Info();
- _tmpInfo.serial = (int) (_stmt.getLong(_cursorIndexOfSerial));
- if (_stmt.isNull(_cursorIndexOfCode)) {
- _tmpInfo.code = null;
- } else {
- _tmpInfo.code = _stmt.getText(_cursorIndexOfCode);
- }
- } else {
- _tmpInfo = null;
- }
- _item = new Child1(_tmpId,_tmpName,_tmpInfo);
- _result.add(_item);
- }
- return _result;
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @Override
- public List<Child2> getChild2List() {
- final String _sql = "SELECT * FROM Child2";
- return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<Child2>>() {
- @Override
- @NonNull
- public List<Child2> invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- final int _cursorIndexOfId = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "id");
- final int _cursorIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name");
- final int _cursorIndexOfSerial = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "serial");
- final int _cursorIndexOfCode = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "code");
- final List<Child2> _result = new ArrayList<Child2>();
- while (_stmt.step()) {
- final Child2 _item;
- final int _tmpId;
- _tmpId = (int) (_stmt.getLong(_cursorIndexOfId));
- final String _tmpName;
- if (_stmt.isNull(_cursorIndexOfName)) {
- _tmpName = null;
- } else {
- _tmpName = _stmt.getText(_cursorIndexOfName);
- }
- final Info _tmpInfo;
- if (!(_stmt.isNull(_cursorIndexOfSerial) && _stmt.isNull(_cursorIndexOfCode))) {
- _tmpInfo = new Info();
- _tmpInfo.serial = (int) (_stmt.getLong(_cursorIndexOfSerial));
- if (_stmt.isNull(_cursorIndexOfCode)) {
- _tmpInfo.code = null;
- } else {
- _tmpInfo.code = _stmt.getText(_cursorIndexOfCode);
- }
- } else {
- _tmpInfo = null;
- }
- _item = new Child2(_tmpId,_tmpName,_tmpInfo);
- _result.add(_item);
- }
- return _result;
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @Override
- public ListenableFuture<List<Child1>> getChild1ListListenableFuture() {
- final String _sql = "SELECT * FROM Child1";
- final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 0);
- final CancellationSignal _cancellationSignal = new CancellationSignal();
- return GuavaRoom.createListenableFuture(__db, false, new Callable<List<Child1>>() {
- @Override
- public List<Child1> call() throws Exception {
- final Cursor _cursor = DBUtil.query(__db, _statement, false, _cancellationSignal);
- try {
- final int _cursorIndexOfId = CursorUtil.getColumnIndexOrThrow(_cursor, "id");
- final int _cursorIndexOfName = CursorUtil.getColumnIndexOrThrow(_cursor, "name");
- final int _cursorIndexOfSerial = CursorUtil.getColumnIndexOrThrow(_cursor, "serial");
- final int _cursorIndexOfCode = CursorUtil.getColumnIndexOrThrow(_cursor, "code");
- final List<Child1> _result = new ArrayList<Child1>();
- while (_cursor.moveToNext()) {
- final Child1 _item;
- final int _tmpId;
- _tmpId = _cursor.getInt(_cursorIndexOfId);
- final String _tmpName;
- if (_cursor.isNull(_cursorIndexOfName)) {
- _tmpName = null;
- } else {
- _tmpName = _cursor.getString(_cursorIndexOfName);
- }
- final Info _tmpInfo;
- if (!(_cursor.isNull(_cursorIndexOfSerial) && _cursor.isNull(_cursorIndexOfCode))) {
- _tmpInfo = new Info();
- _tmpInfo.serial = _cursor.getInt(_cursorIndexOfSerial);
- if (_cursor.isNull(_cursorIndexOfCode)) {
- _tmpInfo.code = null;
- } else {
- _tmpInfo.code = _cursor.getString(_cursorIndexOfCode);
- }
- } else {
- _tmpInfo = null;
- }
- _item = new Child1(_tmpId,_tmpName,_tmpInfo);
- _result.add(_item);
- }
- return _result;
- } finally {
- _cursor.close();
- }
- }
- }, _statement, true, _cancellationSignal);
- }
-
- @Override
- public List<UserSummary> getUserNames() {
- final String _sql = "SELECT `uid`, `name` FROM (SELECT * FROM User)";
- return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<UserSummary>>() {
- @Override
- @NonNull
- public List<UserSummary> invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- final int _cursorIndexOfUid = 0;
- final int _cursorIndexOfName = 1;
- final List<UserSummary> _result = new ArrayList<UserSummary>();
- while (_stmt.step()) {
- final UserSummary _item;
- _item = new UserSummary();
- _item.uid = (int) (_stmt.getLong(_cursorIndexOfUid));
- if (_stmt.isNull(_cursorIndexOfName)) {
- _item.name = null;
- } else {
- _item.name = _stmt.getText(_cursorIndexOfName);
- }
- _result.add(_item);
- }
- return _result;
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @Override
- public User getUserViaRawQuery(final SupportSQLiteQuery rawQuery) {
- __db.assertNotSuspendingTransaction();
- final Cursor _cursor = DBUtil.query(__db, rawQuery, false, null);
+ @Override
+ public List<ComplexDao.FullName> fullNames(final int id) {
+ final String _sql = "SELECT name || lastName as fullName, uid as id FROM user where uid = ?";
+ return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<ComplexDao.FullName>>() {
+ @Override
+ @NonNull
+ public List<ComplexDao.FullName> invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
try {
- final User _result;
- if (_cursor.moveToFirst()) {
- _result = __entityCursorConverter_fooBarUser(_cursor);
+ int _argIndex = 1;
+ _stmt.bindLong(_argIndex, id);
+ final int _cursorIndexOfFullName = 0;
+ final int _cursorIndexOfId = 1;
+ final List<ComplexDao.FullName> _result = new ArrayList<ComplexDao.FullName>();
+ while (_stmt.step()) {
+ final ComplexDao.FullName _item;
+ _item = new ComplexDao.FullName();
+ if (_stmt.isNull(_cursorIndexOfFullName)) {
+ _item.fullName = null;
} else {
- _result = null;
+ _item.fullName = _stmt.getText(_cursorIndexOfFullName);
}
- return _result;
+ _item.id = (int) (_stmt.getLong(_cursorIndexOfId));
+ _result.add(_item);
+ }
+ return _result;
} finally {
- _cursor.close();
+ _stmt.close();
}
- }
+ }
+ });
+ }
- @NonNull
- public static List<Class<?>> getRequiredConverters() {
- return Collections.emptyList();
- }
-
- private User __entityCursorConverter_fooBarUser(@NonNull final Cursor cursor) {
- final User _entity;
- final int _cursorIndexOfUid = CursorUtil.getColumnIndex(cursor, "uid");
- final int _cursorIndexOfName = CursorUtil.getColumnIndex(cursor, "name");
- final int _cursorIndexOfLastName = CursorUtil.getColumnIndex(cursor, "lastName");
- final int _cursorIndexOfAge = CursorUtil.getColumnIndex(cursor, "ageColumn");
- _entity = new User();
- if (_cursorIndexOfUid != -1) {
- _entity.uid = cursor.getInt(_cursorIndexOfUid);
- }
- if (_cursorIndexOfName != -1) {
- if (cursor.isNull(_cursorIndexOfName)) {
- _entity.name = null;
+ @Override
+ public User getById(final int id) {
+ final String _sql = "SELECT * FROM user where uid = ?";
+ return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, User>() {
+ @Override
+ @NonNull
+ public User invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ int _argIndex = 1;
+ _stmt.bindLong(_argIndex, id);
+ final int _cursorIndexOfUid = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "uid");
+ final int _cursorIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name");
+ final int _cursorIndexOfLastName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "lastName");
+ final int _cursorIndexOfAge = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "ageColumn");
+ final User _result;
+ if (_stmt.step()) {
+ _result = new User();
+ _result.uid = (int) (_stmt.getLong(_cursorIndexOfUid));
+ if (_stmt.isNull(_cursorIndexOfName)) {
+ _result.name = null;
} else {
- _entity.name = cursor.getString(_cursorIndexOfName);
+ _result.name = _stmt.getText(_cursorIndexOfName);
}
- }
- if (_cursorIndexOfLastName != -1) {
final String _tmpLastName;
- if (cursor.isNull(_cursorIndexOfLastName)) {
- _tmpLastName = null;
+ if (_stmt.isNull(_cursorIndexOfLastName)) {
+ _tmpLastName = null;
} else {
- _tmpLastName = cursor.getString(_cursorIndexOfLastName);
+ _tmpLastName = _stmt.getText(_cursorIndexOfLastName);
}
- _entity.setLastName(_tmpLastName);
+ _result.setLastName(_tmpLastName);
+ _result.age = (int) (_stmt.getLong(_cursorIndexOfAge));
+ } else {
+ _result = null;
+ }
+ return _result;
+ } finally {
+ _stmt.close();
}
- if (_cursorIndexOfAge != -1) {
- _entity.age = cursor.getInt(_cursorIndexOfAge);
+ }
+ });
+ }
+
+ @Override
+ public User findByName(final String name, final String lastName) {
+ final String _sql = "SELECT * FROM user where name LIKE ? AND lastName LIKE ?";
+ return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, User>() {
+ @Override
+ @NonNull
+ public User invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ int _argIndex = 1;
+ if (name == null) {
+ _stmt.bindNull(_argIndex);
+ } else {
+ _stmt.bindText(_argIndex, name);
+ }
+ _argIndex = 2;
+ if (lastName == null) {
+ _stmt.bindNull(_argIndex);
+ } else {
+ _stmt.bindText(_argIndex, lastName);
+ }
+ final int _cursorIndexOfUid = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "uid");
+ final int _cursorIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name");
+ final int _cursorIndexOfLastName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "lastName");
+ final int _cursorIndexOfAge = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "ageColumn");
+ final User _result;
+ if (_stmt.step()) {
+ _result = new User();
+ _result.uid = (int) (_stmt.getLong(_cursorIndexOfUid));
+ if (_stmt.isNull(_cursorIndexOfName)) {
+ _result.name = null;
+ } else {
+ _result.name = _stmt.getText(_cursorIndexOfName);
+ }
+ final String _tmpLastName;
+ if (_stmt.isNull(_cursorIndexOfLastName)) {
+ _tmpLastName = null;
+ } else {
+ _tmpLastName = _stmt.getText(_cursorIndexOfLastName);
+ }
+ _result.setLastName(_tmpLastName);
+ _result.age = (int) (_stmt.getLong(_cursorIndexOfAge));
+ } else {
+ _result = null;
+ }
+ return _result;
+ } finally {
+ _stmt.close();
}
- return _entity;
+ }
+ });
+ }
+
+ @Override
+ public List<User> loadAllByIds(final int... ids) {
+ final StringBuilder _stringBuilder = new StringBuilder();
+ _stringBuilder.append("SELECT * FROM user where uid IN (");
+ final int _inputSize = ids == null ? 1 : ids.length;
+ StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
+ _stringBuilder.append(")");
+ final String _sql = _stringBuilder.toString();
+ return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<User>>() {
+ @Override
+ @NonNull
+ public List<User> invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ int _argIndex = 1;
+ if (ids == null) {
+ _stmt.bindNull(_argIndex);
+ } else {
+ for (int _item : ids) {
+ _stmt.bindLong(_argIndex, _item);
+ _argIndex++;
+ }
+ }
+ final int _cursorIndexOfUid = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "uid");
+ final int _cursorIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name");
+ final int _cursorIndexOfLastName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "lastName");
+ final int _cursorIndexOfAge = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "ageColumn");
+ final List<User> _result = new ArrayList<User>();
+ while (_stmt.step()) {
+ final User _item_1;
+ _item_1 = new User();
+ _item_1.uid = (int) (_stmt.getLong(_cursorIndexOfUid));
+ if (_stmt.isNull(_cursorIndexOfName)) {
+ _item_1.name = null;
+ } else {
+ _item_1.name = _stmt.getText(_cursorIndexOfName);
+ }
+ final String _tmpLastName;
+ if (_stmt.isNull(_cursorIndexOfLastName)) {
+ _tmpLastName = null;
+ } else {
+ _tmpLastName = _stmt.getText(_cursorIndexOfLastName);
+ }
+ _item_1.setLastName(_tmpLastName);
+ _item_1.age = (int) (_stmt.getLong(_cursorIndexOfAge));
+ _result.add(_item_1);
+ }
+ return _result;
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
+
+ @Override
+ int getAge(final int id) {
+ final String _sql = "SELECT ageColumn FROM user where uid = ?";
+ return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ int _argIndex = 1;
+ _stmt.bindLong(_argIndex, id);
+ final int _result;
+ if (_stmt.step()) {
+ _result = (int) (_stmt.getLong(0));
+ } else {
+ _result = 0;
+ }
+ return _result;
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
+
+ @Override
+ public int[] getAllAges(final int... ids) {
+ final StringBuilder _stringBuilder = new StringBuilder();
+ _stringBuilder.append("SELECT ageColumn FROM user where uid IN(");
+ final int _inputSize = ids == null ? 1 : ids.length;
+ StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
+ _stringBuilder.append(")");
+ final String _sql = _stringBuilder.toString();
+ return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, int[]>() {
+ @Override
+ @NonNull
+ public int[] invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ int _argIndex = 1;
+ if (ids == null) {
+ _stmt.bindNull(_argIndex);
+ } else {
+ for (int _item : ids) {
+ _stmt.bindLong(_argIndex, _item);
+ _argIndex++;
+ }
+ }
+ final List<Integer> _listResult = new ArrayList<Integer>();
+ while (_stmt.step()) {
+ final Integer _item_1;
+ if (_stmt.isNull(0)) {
+ _item_1 = null;
+ } else {
+ _item_1 = (int) (_stmt.getLong(0));
+ }
+ _listResult.add(_item_1);
+ }
+ final int[] _tmpArrayResult = new int[_listResult.size()];
+ int _index = 0;
+ for (int _listItem : _listResult) {
+ _tmpArrayResult[_index] = _listItem;
+ _index++;
+ }
+ final int[] _result = _tmpArrayResult;
+ return _result;
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
+
+ @Override
+ public List<Integer> getAllAgesAsList(final List<Integer> ids) {
+ final StringBuilder _stringBuilder = new StringBuilder();
+ _stringBuilder.append("SELECT ageColumn FROM user where uid IN(");
+ final int _inputSize = ids == null ? 1 : ids.size();
+ StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
+ _stringBuilder.append(")");
+ final String _sql = _stringBuilder.toString();
+ return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<Integer>>() {
+ @Override
+ @NonNull
+ public List<Integer> invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ int _argIndex = 1;
+ if (ids == null) {
+ _stmt.bindNull(_argIndex);
+ } else {
+ for (Integer _item : ids) {
+ if (_item == null) {
+ _stmt.bindNull(_argIndex);
+ } else {
+ _stmt.bindLong(_argIndex, _item);
+ }
+ _argIndex++;
+ }
+ }
+ final List<Integer> _result = new ArrayList<Integer>();
+ while (_stmt.step()) {
+ final Integer _item_1;
+ if (_stmt.isNull(0)) {
+ _item_1 = null;
+ } else {
+ _item_1 = (int) (_stmt.getLong(0));
+ }
+ _result.add(_item_1);
+ }
+ return _result;
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
+
+ @Override
+ public List<Integer> getAllAgesAsList(final List<Integer> ids1, final int[] ids2,
+ final int... ids3) {
+ final StringBuilder _stringBuilder = new StringBuilder();
+ _stringBuilder.append("SELECT ageColumn FROM user where uid IN(");
+ final int _inputSize = ids1 == null ? 1 : ids1.size();
+ StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
+ _stringBuilder.append(") OR uid IN (");
+ final int _inputSize_1 = ids2 == null ? 1 : ids2.length;
+ StringUtil.appendPlaceholders(_stringBuilder, _inputSize_1);
+ _stringBuilder.append(") OR uid IN (");
+ final int _inputSize_2 = ids3 == null ? 1 : ids3.length;
+ StringUtil.appendPlaceholders(_stringBuilder, _inputSize_2);
+ _stringBuilder.append(")");
+ final String _sql = _stringBuilder.toString();
+ return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<Integer>>() {
+ @Override
+ @NonNull
+ public List<Integer> invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ int _argIndex = 1;
+ if (ids1 == null) {
+ _stmt.bindNull(_argIndex);
+ } else {
+ for (Integer _item : ids1) {
+ if (_item == null) {
+ _stmt.bindNull(_argIndex);
+ } else {
+ _stmt.bindLong(_argIndex, _item);
+ }
+ _argIndex++;
+ }
+ }
+ _argIndex = 1 + _inputSize;
+ if (ids2 == null) {
+ _stmt.bindNull(_argIndex);
+ } else {
+ for (int _item_1 : ids2) {
+ _stmt.bindLong(_argIndex, _item_1);
+ _argIndex++;
+ }
+ }
+ _argIndex = 1 + _inputSize + _inputSize_1;
+ if (ids3 == null) {
+ _stmt.bindNull(_argIndex);
+ } else {
+ for (int _item_2 : ids3) {
+ _stmt.bindLong(_argIndex, _item_2);
+ _argIndex++;
+ }
+ }
+ final List<Integer> _result = new ArrayList<Integer>();
+ while (_stmt.step()) {
+ final Integer _item_3;
+ if (_stmt.isNull(0)) {
+ _item_3 = null;
+ } else {
+ _item_3 = (int) (_stmt.getLong(0));
+ }
+ _result.add(_item_3);
+ }
+ return _result;
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
+
+ @Override
+ public LiveData<User> getByIdLive(final int id) {
+ final String _sql = "SELECT * FROM user where uid = ?";
+ final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 1);
+ int _argIndex = 1;
+ _statement.bindLong(_argIndex, id);
+ return __db.getInvalidationTracker().createLiveData(new String[] {"user"}, false, new Callable<User>() {
+ @Override
+ @Nullable
+ public User call() throws Exception {
+ final Cursor _cursor = DBUtil.query(__db, _statement, false, null);
+ try {
+ final int _cursorIndexOfUid = CursorUtil.getColumnIndexOrThrow(_cursor, "uid");
+ final int _cursorIndexOfName = CursorUtil.getColumnIndexOrThrow(_cursor, "name");
+ final int _cursorIndexOfLastName = CursorUtil.getColumnIndexOrThrow(_cursor, "lastName");
+ final int _cursorIndexOfAge = CursorUtil.getColumnIndexOrThrow(_cursor, "ageColumn");
+ final User _result;
+ if (_cursor.moveToFirst()) {
+ _result = new User();
+ _result.uid = _cursor.getInt(_cursorIndexOfUid);
+ if (_cursor.isNull(_cursorIndexOfName)) {
+ _result.name = null;
+ } else {
+ _result.name = _cursor.getString(_cursorIndexOfName);
+ }
+ final String _tmpLastName;
+ if (_cursor.isNull(_cursorIndexOfLastName)) {
+ _tmpLastName = null;
+ } else {
+ _tmpLastName = _cursor.getString(_cursorIndexOfLastName);
+ }
+ _result.setLastName(_tmpLastName);
+ _result.age = _cursor.getInt(_cursorIndexOfAge);
+ } else {
+ _result = null;
+ }
+ return _result;
+ } finally {
+ _cursor.close();
+ }
+ }
+
+ @Override
+ protected void finalize() {
+ _statement.release();
+ }
+ });
+ }
+
+ @Override
+ public LiveData<List<User>> loadUsersByIdsLive(final int... ids) {
+ final StringBuilder _stringBuilder = new StringBuilder();
+ _stringBuilder.append("SELECT * FROM user where uid IN (");
+ final int _inputSize = ids == null ? 1 : ids.length;
+ StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
+ _stringBuilder.append(")");
+ final String _sql = _stringBuilder.toString();
+ final int _argCount = 0 + _inputSize;
+ final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, _argCount);
+ int _argIndex = 1;
+ if (ids == null) {
+ _statement.bindNull(_argIndex);
+ } else {
+ for (int _item : ids) {
+ _statement.bindLong(_argIndex, _item);
+ _argIndex++;
+ }
}
-}
\ No newline at end of file
+ return __db.getInvalidationTracker().createLiveData(new String[] {"user"}, false, new Callable<List<User>>() {
+ @Override
+ @Nullable
+ public List<User> call() throws Exception {
+ final Cursor _cursor = DBUtil.query(__db, _statement, false, null);
+ try {
+ final int _cursorIndexOfUid = CursorUtil.getColumnIndexOrThrow(_cursor, "uid");
+ final int _cursorIndexOfName = CursorUtil.getColumnIndexOrThrow(_cursor, "name");
+ final int _cursorIndexOfLastName = CursorUtil.getColumnIndexOrThrow(_cursor, "lastName");
+ final int _cursorIndexOfAge = CursorUtil.getColumnIndexOrThrow(_cursor, "ageColumn");
+ final List<User> _result = new ArrayList<User>();
+ while (_cursor.moveToNext()) {
+ final User _item_1;
+ _item_1 = new User();
+ _item_1.uid = _cursor.getInt(_cursorIndexOfUid);
+ if (_cursor.isNull(_cursorIndexOfName)) {
+ _item_1.name = null;
+ } else {
+ _item_1.name = _cursor.getString(_cursorIndexOfName);
+ }
+ final String _tmpLastName;
+ if (_cursor.isNull(_cursorIndexOfLastName)) {
+ _tmpLastName = null;
+ } else {
+ _tmpLastName = _cursor.getString(_cursorIndexOfLastName);
+ }
+ _item_1.setLastName(_tmpLastName);
+ _item_1.age = _cursor.getInt(_cursorIndexOfAge);
+ _result.add(_item_1);
+ }
+ return _result;
+ } finally {
+ _cursor.close();
+ }
+ }
+
+ @Override
+ protected void finalize() {
+ _statement.release();
+ }
+ });
+ }
+
+ @Override
+ public List<Child1> getChild1List() {
+ final String _sql = "SELECT * FROM Child1";
+ return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<Child1>>() {
+ @Override
+ @NonNull
+ public List<Child1> invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ final int _cursorIndexOfId = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "id");
+ final int _cursorIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name");
+ final int _cursorIndexOfSerial = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "serial");
+ final int _cursorIndexOfCode = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "code");
+ final List<Child1> _result = new ArrayList<Child1>();
+ while (_stmt.step()) {
+ final Child1 _item;
+ final int _tmpId;
+ _tmpId = (int) (_stmt.getLong(_cursorIndexOfId));
+ final String _tmpName;
+ if (_stmt.isNull(_cursorIndexOfName)) {
+ _tmpName = null;
+ } else {
+ _tmpName = _stmt.getText(_cursorIndexOfName);
+ }
+ final Info _tmpInfo;
+ if (!(_stmt.isNull(_cursorIndexOfSerial) && _stmt.isNull(_cursorIndexOfCode))) {
+ _tmpInfo = new Info();
+ _tmpInfo.serial = (int) (_stmt.getLong(_cursorIndexOfSerial));
+ if (_stmt.isNull(_cursorIndexOfCode)) {
+ _tmpInfo.code = null;
+ } else {
+ _tmpInfo.code = _stmt.getText(_cursorIndexOfCode);
+ }
+ } else {
+ _tmpInfo = null;
+ }
+ _item = new Child1(_tmpId,_tmpName,_tmpInfo);
+ _result.add(_item);
+ }
+ return _result;
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
+
+ @Override
+ public List<Child2> getChild2List() {
+ final String _sql = "SELECT * FROM Child2";
+ return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<Child2>>() {
+ @Override
+ @NonNull
+ public List<Child2> invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ final int _cursorIndexOfId = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "id");
+ final int _cursorIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name");
+ final int _cursorIndexOfSerial = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "serial");
+ final int _cursorIndexOfCode = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "code");
+ final List<Child2> _result = new ArrayList<Child2>();
+ while (_stmt.step()) {
+ final Child2 _item;
+ final int _tmpId;
+ _tmpId = (int) (_stmt.getLong(_cursorIndexOfId));
+ final String _tmpName;
+ if (_stmt.isNull(_cursorIndexOfName)) {
+ _tmpName = null;
+ } else {
+ _tmpName = _stmt.getText(_cursorIndexOfName);
+ }
+ final Info _tmpInfo;
+ if (!(_stmt.isNull(_cursorIndexOfSerial) && _stmt.isNull(_cursorIndexOfCode))) {
+ _tmpInfo = new Info();
+ _tmpInfo.serial = (int) (_stmt.getLong(_cursorIndexOfSerial));
+ if (_stmt.isNull(_cursorIndexOfCode)) {
+ _tmpInfo.code = null;
+ } else {
+ _tmpInfo.code = _stmt.getText(_cursorIndexOfCode);
+ }
+ } else {
+ _tmpInfo = null;
+ }
+ _item = new Child2(_tmpId,_tmpName,_tmpInfo);
+ _result.add(_item);
+ }
+ return _result;
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<List<Child1>> getChild1ListListenableFuture() {
+ final String _sql = "SELECT * FROM Child1";
+ final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 0);
+ final CancellationSignal _cancellationSignal = new CancellationSignal();
+ return GuavaRoom.createListenableFuture(__db, false, new Callable<List<Child1>>() {
+ @Override
+ public List<Child1> call() throws Exception {
+ final Cursor _cursor = DBUtil.query(__db, _statement, false, _cancellationSignal);
+ try {
+ final int _cursorIndexOfId = CursorUtil.getColumnIndexOrThrow(_cursor, "id");
+ final int _cursorIndexOfName = CursorUtil.getColumnIndexOrThrow(_cursor, "name");
+ final int _cursorIndexOfSerial = CursorUtil.getColumnIndexOrThrow(_cursor, "serial");
+ final int _cursorIndexOfCode = CursorUtil.getColumnIndexOrThrow(_cursor, "code");
+ final List<Child1> _result = new ArrayList<Child1>();
+ while (_cursor.moveToNext()) {
+ final Child1 _item;
+ final int _tmpId;
+ _tmpId = _cursor.getInt(_cursorIndexOfId);
+ final String _tmpName;
+ if (_cursor.isNull(_cursorIndexOfName)) {
+ _tmpName = null;
+ } else {
+ _tmpName = _cursor.getString(_cursorIndexOfName);
+ }
+ final Info _tmpInfo;
+ if (!(_cursor.isNull(_cursorIndexOfSerial) && _cursor.isNull(_cursorIndexOfCode))) {
+ _tmpInfo = new Info();
+ _tmpInfo.serial = _cursor.getInt(_cursorIndexOfSerial);
+ if (_cursor.isNull(_cursorIndexOfCode)) {
+ _tmpInfo.code = null;
+ } else {
+ _tmpInfo.code = _cursor.getString(_cursorIndexOfCode);
+ }
+ } else {
+ _tmpInfo = null;
+ }
+ _item = new Child1(_tmpId,_tmpName,_tmpInfo);
+ _result.add(_item);
+ }
+ return _result;
+ } finally {
+ _cursor.close();
+ }
+ }
+ }, _statement, true, _cancellationSignal);
+ }
+
+ @Override
+ public List<UserSummary> getUserNames() {
+ final String _sql = "SELECT `uid`, `name` FROM (SELECT * FROM User)";
+ return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<UserSummary>>() {
+ @Override
+ @NonNull
+ public List<UserSummary> invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ final int _cursorIndexOfUid = 0;
+ final int _cursorIndexOfName = 1;
+ final List<UserSummary> _result = new ArrayList<UserSummary>();
+ while (_stmt.step()) {
+ final UserSummary _item;
+ _item = new UserSummary();
+ _item.uid = (int) (_stmt.getLong(_cursorIndexOfUid));
+ if (_stmt.isNull(_cursorIndexOfName)) {
+ _item.name = null;
+ } else {
+ _item.name = _stmt.getText(_cursorIndexOfName);
+ }
+ _result.add(_item);
+ }
+ return _result;
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
+
+ @Override
+ public User getUserViaRawQuery(final SupportSQLiteQuery rawQuery) {
+ __db.assertNotSuspendingTransaction();
+ final Cursor _cursor = DBUtil.query(__db, rawQuery, false, null);
+ try {
+ final User _result;
+ if (_cursor.moveToFirst()) {
+ _result = __entityCursorConverter_fooBarUser(_cursor);
+ } else {
+ _result = null;
+ }
+ return _result;
+ } finally {
+ _cursor.close();
+ }
+ }
+
+ @NonNull
+ public static List<Class<?>> getRequiredConverters() {
+ return Collections.emptyList();
+ }
+
+ private User __entityCursorConverter_fooBarUser(@NonNull final Cursor cursor) {
+ final User _entity;
+ final int _cursorIndexOfUid = CursorUtil.getColumnIndex(cursor, "uid");
+ final int _cursorIndexOfName = CursorUtil.getColumnIndex(cursor, "name");
+ final int _cursorIndexOfLastName = CursorUtil.getColumnIndex(cursor, "lastName");
+ final int _cursorIndexOfAge = CursorUtil.getColumnIndex(cursor, "ageColumn");
+ _entity = new User();
+ if (_cursorIndexOfUid != -1) {
+ _entity.uid = cursor.getInt(_cursorIndexOfUid);
+ }
+ if (_cursorIndexOfName != -1) {
+ if (cursor.isNull(_cursorIndexOfName)) {
+ _entity.name = null;
+ } else {
+ _entity.name = cursor.getString(_cursorIndexOfName);
+ }
+ }
+ if (_cursorIndexOfLastName != -1) {
+ final String _tmpLastName;
+ if (cursor.isNull(_cursorIndexOfLastName)) {
+ _tmpLastName = null;
+ } else {
+ _tmpLastName = cursor.getString(_cursorIndexOfLastName);
+ }
+ _entity.setLastName(_tmpLastName);
+ }
+ if (_cursorIndexOfAge != -1) {
+ _entity.age = cursor.getInt(_cursorIndexOfAge);
+ }
+ return _entity;
+ }
+}
diff --git a/room/room-compiler/src/test/test-data/daoWriter/output/javac/DeletionDao.java b/room/room-compiler/src/test/test-data/daoWriter/output/javac/DeletionDao.java
index c773530..e287d17 100644
--- a/room/room-compiler/src/test/test-data/daoWriter/output/javac/DeletionDao.java
+++ b/room/room-compiler/src/test/test-data/daoWriter/output/javac/DeletionDao.java
@@ -31,387 +31,387 @@
@Generated("androidx.room.RoomProcessor")
@SuppressWarnings({"unchecked", "deprecation", "removal"})
public final class DeletionDao_Impl implements DeletionDao {
- private final RoomDatabase __db;
+ private final RoomDatabase __db;
- private final EntityDeleteOrUpdateAdapter<User> __deleteAdapterOfUser;
+ private final EntityDeleteOrUpdateAdapter<User> __deleteAdapterOfUser;
- private final EntityDeletionOrUpdateAdapter<User> __deleteCompatAdapterOfUser;
+ private final EntityDeletionOrUpdateAdapter<User> __deleteCompatAdapterOfUser;
- private final EntityDeleteOrUpdateAdapter<MultiPKeyEntity> __deleteAdapterOfMultiPKeyEntity;
+ private final EntityDeleteOrUpdateAdapter<MultiPKeyEntity> __deleteAdapterOfMultiPKeyEntity;
- private final EntityDeleteOrUpdateAdapter<Book> __deleteAdapterOfBook;
+ private final EntityDeleteOrUpdateAdapter<Book> __deleteAdapterOfBook;
- public DeletionDao_Impl(@NonNull final RoomDatabase __db) {
- this.__db = __db;
- this.__deleteAdapterOfUser = new EntityDeleteOrUpdateAdapter<User>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "DELETE FROM `User` WHERE `uid` = ?";
- }
+ public DeletionDao_Impl(@NonNull final RoomDatabase __db) {
+ this.__db = __db;
+ this.__deleteAdapterOfUser = new EntityDeleteOrUpdateAdapter<User>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "DELETE FROM `User` WHERE `uid` = ?";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, final User entity) {
- statement.bindLong(1, entity.uid);
- }
- };
- this.__deleteCompatAdapterOfUser = new EntityDeletionOrUpdateAdapter<User>(__db) {
- @Override
- @NonNull
- protected String createQuery() {
- return "DELETE FROM `User` WHERE `uid` = ?";
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, final User entity) {
+ statement.bindLong(1, entity.uid);
+ }
+ };
+ this.__deleteCompatAdapterOfUser = new EntityDeletionOrUpdateAdapter<User>(__db) {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "DELETE FROM `User` WHERE `uid` = ?";
+ }
- @Override
- protected void bind(@NonNull final SupportSQLiteStatement statement, final User entity) {
- statement.bindLong(1, entity.uid);
- }
- };
- this.__deleteAdapterOfMultiPKeyEntity = new EntityDeleteOrUpdateAdapter<MultiPKeyEntity>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "DELETE FROM `MultiPKeyEntity` WHERE `name` = ? AND `lastName` = ?";
- }
+ @Override
+ protected void bind(@NonNull final SupportSQLiteStatement statement, final User entity) {
+ statement.bindLong(1, entity.uid);
+ }
+ };
+ this.__deleteAdapterOfMultiPKeyEntity = new EntityDeleteOrUpdateAdapter<MultiPKeyEntity>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "DELETE FROM `MultiPKeyEntity` WHERE `name` = ? AND `lastName` = ?";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, final MultiPKeyEntity entity) {
- if (entity.name == null) {
- statement.bindNull(1);
- } else {
- statement.bindText(1, entity.name);
- }
- if (entity.lastName == null) {
- statement.bindNull(2);
- } else {
- statement.bindText(2, entity.lastName);
- }
- }
- };
- this.__deleteAdapterOfBook = new EntityDeleteOrUpdateAdapter<Book>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "DELETE FROM `Book` WHERE `bookId` = ?";
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, final MultiPKeyEntity entity) {
+ if (entity.name == null) {
+ statement.bindNull(1);
+ } else {
+ statement.bindText(1, entity.name);
+ }
+ if (entity.lastName == null) {
+ statement.bindNull(2);
+ } else {
+ statement.bindText(2, entity.lastName);
+ }
+ }
+ };
+ this.__deleteAdapterOfBook = new EntityDeleteOrUpdateAdapter<Book>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "DELETE FROM `Book` WHERE `bookId` = ?";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, final Book entity) {
- statement.bindLong(1, entity.bookId);
- }
- };
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, final Book entity) {
+ statement.bindLong(1, entity.bookId);
+ }
+ };
+ }
- @Override
- public void deleteUser(final User user) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __deleteAdapterOfUser.handle(_connection, user);
- return null;
- }
- });
- }
+ @Override
+ public void deleteUser(final User user) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __deleteAdapterOfUser.handle(_connection, user);
+ return null;
+ }
+ });
+ }
- @Override
- public void deleteUsers(final User user1, final List<User> others) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __deleteAdapterOfUser.handle(_connection, user1);
- __deleteAdapterOfUser.handleMultiple(_connection, others);
- return null;
- }
- });
- }
+ @Override
+ public void deleteUsers(final User user1, final List<User> others) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __deleteAdapterOfUser.handle(_connection, user1);
+ __deleteAdapterOfUser.handleMultiple(_connection, others);
+ return null;
+ }
+ });
+ }
- @Override
- public void deleteArrayOfUsers(final User[] users) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __deleteAdapterOfUser.handleMultiple(_connection, users);
- return null;
- }
- });
- }
+ @Override
+ public void deleteArrayOfUsers(final User[] users) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __deleteAdapterOfUser.handleMultiple(_connection, users);
+ return null;
+ }
+ });
+ }
- @Override
- public Integer deleteUserAndReturnCountObject(final User user) {
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- int _result = 0;
- _result += __deleteAdapterOfUser.handle(_connection, user);
- return _result;
- }
- });
- }
+ @Override
+ public Integer deleteUserAndReturnCountObject(final User user) {
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ int _result = 0;
+ _result += __deleteAdapterOfUser.handle(_connection, user);
+ return _result;
+ }
+ });
+ }
- @Override
- public int deleteUserAndReturnCount(final User user) {
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- int _result = 0;
- _result += __deleteAdapterOfUser.handle(_connection, user);
- return _result;
- }
- });
- }
+ @Override
+ public int deleteUserAndReturnCount(final User user) {
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ int _result = 0;
+ _result += __deleteAdapterOfUser.handle(_connection, user);
+ return _result;
+ }
+ });
+ }
- @Override
- public int deleteUserAndReturnCount(final User user1, final List<User> others) {
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- int _result = 0;
- _result += __deleteAdapterOfUser.handle(_connection, user1);
- _result += __deleteAdapterOfUser.handleMultiple(_connection, others);
- return _result;
- }
- });
- }
+ @Override
+ public int deleteUserAndReturnCount(final User user1, final List<User> others) {
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ int _result = 0;
+ _result += __deleteAdapterOfUser.handle(_connection, user1);
+ _result += __deleteAdapterOfUser.handleMultiple(_connection, others);
+ return _result;
+ }
+ });
+ }
- @Override
- public int deleteUserAndReturnCount(final User[] users) {
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- int _result = 0;
- _result += __deleteAdapterOfUser.handleMultiple(_connection, users);
- return _result;
- }
- });
- }
+ @Override
+ public int deleteUserAndReturnCount(final User[] users) {
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ int _result = 0;
+ _result += __deleteAdapterOfUser.handleMultiple(_connection, users);
+ return _result;
+ }
+ });
+ }
- @Override
- public Completable deleteUserCompletable(final User user) {
- return Completable.fromCallable(new Callable<Void>() {
- @Override
- @Nullable
- public Void call() throws Exception {
- __db.beginTransaction();
- try {
- __deleteCompatAdapterOfUser.handle(user);
- __db.setTransactionSuccessful();
- return null;
- } finally {
- __db.endTransaction();
- }
- }
- });
- }
+ @Override
+ public Completable deleteUserCompletable(final User user) {
+ return Completable.fromCallable(new Callable<Void>() {
+ @Override
+ @Nullable
+ public Void call() throws Exception {
+ __db.beginTransaction();
+ try {
+ __deleteCompatAdapterOfUser.handle(user);
+ __db.setTransactionSuccessful();
+ return null;
+ } finally {
+ __db.endTransaction();
+ }
+ }
+ });
+ }
- @Override
- public Single<Integer> deleteUserSingle(final User user) {
- return Single.fromCallable(new Callable<Integer>() {
- @Override
- @Nullable
- public Integer call() throws Exception {
- int _total = 0;
- __db.beginTransaction();
- try {
- _total += __deleteCompatAdapterOfUser.handle(user);
- __db.setTransactionSuccessful();
- return _total;
- } finally {
- __db.endTransaction();
- }
- }
- });
- }
+ @Override
+ public Single<Integer> deleteUserSingle(final User user) {
+ return Single.fromCallable(new Callable<Integer>() {
+ @Override
+ @Nullable
+ public Integer call() throws Exception {
+ int _total = 0;
+ __db.beginTransaction();
+ try {
+ _total += __deleteCompatAdapterOfUser.handle(user);
+ __db.setTransactionSuccessful();
+ return _total;
+ } finally {
+ __db.endTransaction();
+ }
+ }
+ });
+ }
- @Override
- public Maybe<Integer> deleteUserMaybe(final User user) {
- return Maybe.fromCallable(new Callable<Integer>() {
- @Override
- @Nullable
- public Integer call() throws Exception {
- int _total = 0;
- __db.beginTransaction();
- try {
- _total += __deleteCompatAdapterOfUser.handle(user);
- __db.setTransactionSuccessful();
- return _total;
- } finally {
- __db.endTransaction();
- }
- }
- });
- }
+ @Override
+ public Maybe<Integer> deleteUserMaybe(final User user) {
+ return Maybe.fromCallable(new Callable<Integer>() {
+ @Override
+ @Nullable
+ public Integer call() throws Exception {
+ int _total = 0;
+ __db.beginTransaction();
+ try {
+ _total += __deleteCompatAdapterOfUser.handle(user);
+ __db.setTransactionSuccessful();
+ return _total;
+ } finally {
+ __db.endTransaction();
+ }
+ }
+ });
+ }
- @Override
- public int multiPKey(final MultiPKeyEntity entity) {
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- int _result = 0;
- _result += __deleteAdapterOfMultiPKeyEntity.handle(_connection, entity);
- return _result;
- }
- });
- }
+ @Override
+ public int multiPKey(final MultiPKeyEntity entity) {
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ int _result = 0;
+ _result += __deleteAdapterOfMultiPKeyEntity.handle(_connection, entity);
+ return _result;
+ }
+ });
+ }
- @Override
- public void deleteUserAndBook(final User user, final Book book) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __deleteAdapterOfUser.handle(_connection, user);
- __deleteAdapterOfBook.handle(_connection, book);
- return null;
- }
- });
- }
+ @Override
+ public void deleteUserAndBook(final User user, final Book book) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __deleteAdapterOfUser.handle(_connection, user);
+ __deleteAdapterOfBook.handle(_connection, book);
+ return null;
+ }
+ });
+ }
- @Override
- public int deleteByUid(final int uid) {
+ @Override
+ public int deleteByUid(final int uid) {
+ final String _sql = "DELETE FROM user where uid = ?";
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ int _argIndex = 1;
+ _stmt.bindLong(_argIndex, uid);
+ _stmt.step();
+ return SQLiteConnectionUtil.getTotalChangedRows(_connection);
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
+
+ @Override
+ public Completable deleteByUidCompletable(final int uid) {
+ return Completable.fromCallable(new Callable<Void>() {
+ @Override
+ @Nullable
+ public Void call() throws Exception {
final String _sql = "DELETE FROM user where uid = ?";
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- int _argIndex = 1;
- _stmt.bindLong(_argIndex, uid);
- _stmt.step();
- return SQLiteConnectionUtil.getTotalChangedRows(_connection);
- } finally {
- _stmt.close();
- }
- }
- });
- }
+ final SupportSQLiteStatement _stmt = __db.compileStatement(_sql);
+ int _argIndex = 1;
+ _stmt.bindLong(_argIndex, uid);
+ __db.beginTransaction();
+ try {
+ _stmt.executeUpdateDelete();
+ __db.setTransactionSuccessful();
+ return null;
+ } finally {
+ __db.endTransaction();
+ }
+ }
+ });
+ }
- @Override
- public Completable deleteByUidCompletable(final int uid) {
- return Completable.fromCallable(new Callable<Void>() {
- @Override
- @Nullable
- public Void call() throws Exception {
- final String _sql = "DELETE FROM user where uid = ?";
- final SupportSQLiteStatement _stmt = __db.compileStatement(_sql);
- int _argIndex = 1;
- _stmt.bindLong(_argIndex, uid);
- __db.beginTransaction();
- try {
- _stmt.executeUpdateDelete();
- __db.setTransactionSuccessful();
- return null;
- } finally {
- __db.endTransaction();
- }
- }
- });
- }
+ @Override
+ public Single<Integer> deleteByUidSingle(final int uid) {
+ return Single.fromCallable(new Callable<Integer>() {
+ @Override
+ @Nullable
+ public Integer call() throws Exception {
+ final String _sql = "DELETE FROM user where uid = ?";
+ final SupportSQLiteStatement _stmt = __db.compileStatement(_sql);
+ int _argIndex = 1;
+ _stmt.bindLong(_argIndex, uid);
+ __db.beginTransaction();
+ try {
+ final Integer _result = _stmt.executeUpdateDelete();
+ __db.setTransactionSuccessful();
+ return _result;
+ } finally {
+ __db.endTransaction();
+ }
+ }
+ });
+ }
- @Override
- public Single<Integer> deleteByUidSingle(final int uid) {
- return Single.fromCallable(new Callable<Integer>() {
- @Override
- @Nullable
- public Integer call() throws Exception {
- final String _sql = "DELETE FROM user where uid = ?";
- final SupportSQLiteStatement _stmt = __db.compileStatement(_sql);
- int _argIndex = 1;
- _stmt.bindLong(_argIndex, uid);
- __db.beginTransaction();
- try {
- final Integer _result = _stmt.executeUpdateDelete();
- __db.setTransactionSuccessful();
- return _result;
- } finally {
- __db.endTransaction();
- }
- }
- });
- }
+ @Override
+ public Maybe<Integer> deleteByUidMaybe(final int uid) {
+ return Maybe.fromCallable(new Callable<Integer>() {
+ @Override
+ @Nullable
+ public Integer call() throws Exception {
+ final String _sql = "DELETE FROM user where uid = ?";
+ final SupportSQLiteStatement _stmt = __db.compileStatement(_sql);
+ int _argIndex = 1;
+ _stmt.bindLong(_argIndex, uid);
+ __db.beginTransaction();
+ try {
+ final Integer _result = _stmt.executeUpdateDelete();
+ __db.setTransactionSuccessful();
+ return _result;
+ } finally {
+ __db.endTransaction();
+ }
+ }
+ });
+ }
- @Override
- public Maybe<Integer> deleteByUidMaybe(final int uid) {
- return Maybe.fromCallable(new Callable<Integer>() {
- @Override
- @Nullable
- public Integer call() throws Exception {
- final String _sql = "DELETE FROM user where uid = ?";
- final SupportSQLiteStatement _stmt = __db.compileStatement(_sql);
- int _argIndex = 1;
- _stmt.bindLong(_argIndex, uid);
- __db.beginTransaction();
- try {
- final Integer _result = _stmt.executeUpdateDelete();
- __db.setTransactionSuccessful();
- return _result;
- } finally {
- __db.endTransaction();
- }
+ @Override
+ public int deleteByUidList(final int... uid) {
+ final StringBuilder _stringBuilder = new StringBuilder();
+ _stringBuilder.append("DELETE FROM user where uid IN(");
+ final int _inputSize = uid == null ? 1 : uid.length;
+ StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
+ _stringBuilder.append(")");
+ final String _sql = _stringBuilder.toString();
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ int _argIndex = 1;
+ if (uid == null) {
+ _stmt.bindNull(_argIndex);
+ } else {
+ for (int _item : uid) {
+ _stmt.bindLong(_argIndex, _item);
+ _argIndex++;
}
- });
- }
+ }
+ _stmt.step();
+ return SQLiteConnectionUtil.getTotalChangedRows(_connection);
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
- @Override
- public int deleteByUidList(final int... uid) {
- final StringBuilder _stringBuilder = new StringBuilder();
- _stringBuilder.append("DELETE FROM user where uid IN(");
- final int _inputSize = uid == null ? 1 : uid.length;
- StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
- _stringBuilder.append(")");
- final String _sql = _stringBuilder.toString();
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- int _argIndex = 1;
- if (uid == null) {
- _stmt.bindNull(_argIndex);
- } else {
- for (int _item : uid) {
- _stmt.bindLong(_argIndex, _item);
- _argIndex++;
- }
- }
- _stmt.step();
- return SQLiteConnectionUtil.getTotalChangedRows(_connection);
- } finally {
- _stmt.close();
- }
- }
- });
- }
+ @Override
+ public int deleteEverything() {
+ final String _sql = "DELETE FROM user";
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ _stmt.step();
+ return SQLiteConnectionUtil.getTotalChangedRows(_connection);
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
- @Override
- public int deleteEverything() {
- final String _sql = "DELETE FROM user";
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- _stmt.step();
- return SQLiteConnectionUtil.getTotalChangedRows(_connection);
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @NonNull
- public static List<Class<?>> getRequiredConverters() {
- return Collections.emptyList();
- }
-}
\ No newline at end of file
+ @NonNull
+ public static List<Class<?>> getRequiredConverters() {
+ return Collections.emptyList();
+ }
+}
diff --git a/room/room-compiler/src/test/test-data/daoWriter/output/javac/UpdateDao.java b/room/room-compiler/src/test/test-data/daoWriter/output/javac/UpdateDao.java
index 39eb440..bdb28be 100644
--- a/room/room-compiler/src/test/test-data/daoWriter/output/javac/UpdateDao.java
+++ b/room/room-compiler/src/test/test-data/daoWriter/output/javac/UpdateDao.java
@@ -29,436 +29,436 @@
@Generated("androidx.room.RoomProcessor")
@SuppressWarnings({"unchecked", "deprecation", "removal"})
public final class UpdateDao_Impl implements UpdateDao {
- private final RoomDatabase __db;
+ private final RoomDatabase __db;
- private final EntityDeleteOrUpdateAdapter<User> __updateAdapterOfUser;
+ private final EntityDeleteOrUpdateAdapter<User> __updateAdapterOfUser;
- private final EntityDeleteOrUpdateAdapter<User> __updateAdapterOfUser_1;
+ private final EntityDeleteOrUpdateAdapter<User> __updateAdapterOfUser_1;
- private final EntityDeletionOrUpdateAdapter<User> __updateCompatAdapterOfUser;
+ private final EntityDeletionOrUpdateAdapter<User> __updateCompatAdapterOfUser;
- private final EntityDeleteOrUpdateAdapter<MultiPKeyEntity> __updateAdapterOfMultiPKeyEntity;
+ private final EntityDeleteOrUpdateAdapter<MultiPKeyEntity> __updateAdapterOfMultiPKeyEntity;
- private final EntityDeleteOrUpdateAdapter<Book> __updateAdapterOfBook;
+ private final EntityDeleteOrUpdateAdapter<Book> __updateAdapterOfBook;
- public UpdateDao_Impl(@NonNull final RoomDatabase __db) {
- this.__db = __db;
- this.__updateAdapterOfUser = new EntityDeleteOrUpdateAdapter<User>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "UPDATE OR ABORT `User` SET `uid` = ?,`name` = ?,`lastName` = ?,`ageColumn` = ? WHERE `uid` = ?";
- }
+ public UpdateDao_Impl(@NonNull final RoomDatabase __db) {
+ this.__db = __db;
+ this.__updateAdapterOfUser = new EntityDeleteOrUpdateAdapter<User>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "UPDATE OR ABORT `User` SET `uid` = ?,`name` = ?,`lastName` = ?,`ageColumn` = ? WHERE `uid` = ?";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, final User entity) {
- statement.bindLong(1, entity.uid);
- if (entity.name == null) {
- statement.bindNull(2);
- } else {
- statement.bindText(2, entity.name);
- }
- if (entity.getLastName() == null) {
- statement.bindNull(3);
- } else {
- statement.bindText(3, entity.getLastName());
- }
- statement.bindLong(4, entity.age);
- statement.bindLong(5, entity.uid);
- }
- };
- this.__updateAdapterOfUser_1 = new EntityDeleteOrUpdateAdapter<User>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "UPDATE `User` SET `uid` = ?,`name` = ?,`lastName` = ?,`ageColumn` = ? WHERE `uid` = ?";
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, final User entity) {
+ statement.bindLong(1, entity.uid);
+ if (entity.name == null) {
+ statement.bindNull(2);
+ } else {
+ statement.bindText(2, entity.name);
+ }
+ if (entity.getLastName() == null) {
+ statement.bindNull(3);
+ } else {
+ statement.bindText(3, entity.getLastName());
+ }
+ statement.bindLong(4, entity.age);
+ statement.bindLong(5, entity.uid);
+ }
+ };
+ this.__updateAdapterOfUser_1 = new EntityDeleteOrUpdateAdapter<User>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "UPDATE `User` SET `uid` = ?,`name` = ?,`lastName` = ?,`ageColumn` = ? WHERE `uid` = ?";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, final User entity) {
- statement.bindLong(1, entity.uid);
- if (entity.name == null) {
- statement.bindNull(2);
- } else {
- statement.bindText(2, entity.name);
- }
- if (entity.getLastName() == null) {
- statement.bindNull(3);
- } else {
- statement.bindText(3, entity.getLastName());
- }
- statement.bindLong(4, entity.age);
- statement.bindLong(5, entity.uid);
- }
- };
- this.__updateCompatAdapterOfUser = new EntityDeletionOrUpdateAdapter<User>(__db) {
- @Override
- @NonNull
- protected String createQuery() {
- return "UPDATE OR ABORT `User` SET `uid` = ?,`name` = ?,`lastName` = ?,`ageColumn` = ? WHERE `uid` = ?";
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, final User entity) {
+ statement.bindLong(1, entity.uid);
+ if (entity.name == null) {
+ statement.bindNull(2);
+ } else {
+ statement.bindText(2, entity.name);
+ }
+ if (entity.getLastName() == null) {
+ statement.bindNull(3);
+ } else {
+ statement.bindText(3, entity.getLastName());
+ }
+ statement.bindLong(4, entity.age);
+ statement.bindLong(5, entity.uid);
+ }
+ };
+ this.__updateCompatAdapterOfUser = new EntityDeletionOrUpdateAdapter<User>(__db) {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "UPDATE OR ABORT `User` SET `uid` = ?,`name` = ?,`lastName` = ?,`ageColumn` = ? WHERE `uid` = ?";
+ }
- @Override
- protected void bind(@NonNull final SupportSQLiteStatement statement, final User entity) {
- statement.bindLong(1, entity.uid);
- if (entity.name == null) {
- statement.bindNull(2);
- } else {
- statement.bindString(2, entity.name);
- }
- if (entity.getLastName() == null) {
- statement.bindNull(3);
- } else {
- statement.bindString(3, entity.getLastName());
- }
- statement.bindLong(4, entity.age);
- statement.bindLong(5, entity.uid);
- }
- };
- this.__updateAdapterOfMultiPKeyEntity = new EntityDeleteOrUpdateAdapter<MultiPKeyEntity>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "UPDATE OR ABORT `MultiPKeyEntity` SET `name` = ?,`lastName` = ? WHERE `name` = ? AND `lastName` = ?";
- }
+ @Override
+ protected void bind(@NonNull final SupportSQLiteStatement statement, final User entity) {
+ statement.bindLong(1, entity.uid);
+ if (entity.name == null) {
+ statement.bindNull(2);
+ } else {
+ statement.bindString(2, entity.name);
+ }
+ if (entity.getLastName() == null) {
+ statement.bindNull(3);
+ } else {
+ statement.bindString(3, entity.getLastName());
+ }
+ statement.bindLong(4, entity.age);
+ statement.bindLong(5, entity.uid);
+ }
+ };
+ this.__updateAdapterOfMultiPKeyEntity = new EntityDeleteOrUpdateAdapter<MultiPKeyEntity>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "UPDATE OR ABORT `MultiPKeyEntity` SET `name` = ?,`lastName` = ? WHERE `name` = ? AND `lastName` = ?";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, final MultiPKeyEntity entity) {
- if (entity.name == null) {
- statement.bindNull(1);
- } else {
- statement.bindText(1, entity.name);
- }
- if (entity.lastName == null) {
- statement.bindNull(2);
- } else {
- statement.bindText(2, entity.lastName);
- }
- if (entity.name == null) {
- statement.bindNull(3);
- } else {
- statement.bindText(3, entity.name);
- }
- if (entity.lastName == null) {
- statement.bindNull(4);
- } else {
- statement.bindText(4, entity.lastName);
- }
- }
- };
- this.__updateAdapterOfBook = new EntityDeleteOrUpdateAdapter<Book>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "UPDATE OR ABORT `Book` SET `bookId` = ?,`uid` = ? WHERE `bookId` = ?";
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, final MultiPKeyEntity entity) {
+ if (entity.name == null) {
+ statement.bindNull(1);
+ } else {
+ statement.bindText(1, entity.name);
+ }
+ if (entity.lastName == null) {
+ statement.bindNull(2);
+ } else {
+ statement.bindText(2, entity.lastName);
+ }
+ if (entity.name == null) {
+ statement.bindNull(3);
+ } else {
+ statement.bindText(3, entity.name);
+ }
+ if (entity.lastName == null) {
+ statement.bindNull(4);
+ } else {
+ statement.bindText(4, entity.lastName);
+ }
+ }
+ };
+ this.__updateAdapterOfBook = new EntityDeleteOrUpdateAdapter<Book>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "UPDATE OR ABORT `Book` SET `bookId` = ?,`uid` = ? WHERE `bookId` = ?";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, final Book entity) {
- statement.bindLong(1, entity.bookId);
- statement.bindLong(2, entity.uid);
- statement.bindLong(3, entity.bookId);
- }
- };
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, final Book entity) {
+ statement.bindLong(1, entity.bookId);
+ statement.bindLong(2, entity.uid);
+ statement.bindLong(3, entity.bookId);
+ }
+ };
+ }
- @Override
- public void updateUser(final User user) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __updateAdapterOfUser.handle(_connection, user);
- return null;
- }
+ @Override
+ public void updateUser(final User user) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __updateAdapterOfUser.handle(_connection, user);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public void updateUsers(final User user1, final List<User> others) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __updateAdapterOfUser.handle(_connection, user1);
+ __updateAdapterOfUser.handleMultiple(_connection, others);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public void updateArrayOfUsers(final User[] users) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __updateAdapterOfUser.handleMultiple(_connection, users);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public void updateTwoUsers(final User userOne, final User userTwo) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __updateAdapterOfUser_1.handle(_connection, userOne);
+ __updateAdapterOfUser_1.handle(_connection, userTwo);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public int updateUserAndReturnCount(final User user) {
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ int _result = 0;
+ _result += __updateAdapterOfUser.handle(_connection, user);
+ return _result;
+ }
+ });
+ }
+
+ @Override
+ public int updateUserAndReturnCount(final User user1, final List<User> others) {
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ int _result = 0;
+ _result += __updateAdapterOfUser.handle(_connection, user1);
+ _result += __updateAdapterOfUser.handleMultiple(_connection, others);
+ return _result;
+ }
+ });
+ }
+
+ @Override
+ public int updateUserAndReturnCount(final User[] users) {
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ int _result = 0;
+ _result += __updateAdapterOfUser.handleMultiple(_connection, users);
+ return _result;
+ }
+ });
+ }
+
+ @Override
+ public Integer updateUserAndReturnCountObject(final User user) {
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ int _result = 0;
+ _result += __updateAdapterOfUser.handle(_connection, user);
+ return _result;
+ }
+ });
+ }
+
+ @Override
+ public Completable updateUserAndReturnCountCompletable(final User user) {
+ return Completable.fromCallable(new Callable<Void>() {
+ @Override
+ @Nullable
+ public Void call() throws Exception {
+ __db.beginTransaction();
+ try {
+ __updateCompatAdapterOfUser.handle(user);
+ __db.setTransactionSuccessful();
+ return null;
+ } finally {
+ __db.endTransaction();
+ }
+ }
+ });
+ }
+
+ @Override
+ public Single<Integer> updateUserAndReturnCountSingle(final User user) {
+ return Single.fromCallable(new Callable<Integer>() {
+ @Override
+ @Nullable
+ public Integer call() throws Exception {
+ int _total = 0;
+ __db.beginTransaction();
+ try {
+ _total += __updateCompatAdapterOfUser.handle(user);
+ __db.setTransactionSuccessful();
+ return _total;
+ } finally {
+ __db.endTransaction();
+ }
+ }
+ });
+ }
+
+ @Override
+ public Maybe<Integer> updateUserAndReturnCountMaybe(final User user) {
+ return Maybe.fromCallable(new Callable<Integer>() {
+ @Override
+ @Nullable
+ public Integer call() throws Exception {
+ int _total = 0;
+ __db.beginTransaction();
+ try {
+ _total += __updateCompatAdapterOfUser.handle(user);
+ __db.setTransactionSuccessful();
+ return _total;
+ } finally {
+ __db.endTransaction();
+ }
+ }
+ });
+ }
+
+ @Override
+ public int multiPKey(final MultiPKeyEntity entity) {
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ int _result = 0;
+ _result += __updateAdapterOfMultiPKeyEntity.handle(_connection, entity);
+ return _result;
+ }
+ });
+ }
+
+ @Override
+ public void updateUserAndBook(final User user, final Book book) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __updateAdapterOfUser.handle(_connection, user);
+ __updateAdapterOfBook.handle(_connection, book);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public void updateAndAge(final User user) {
+ DBUtil.performBlocking(__db, false, true, (_connection) -> {
+ UpdateDao.super.updateAndAge(user);
+ return Unit.INSTANCE;
});
- }
+ }
- @Override
- public void updateUsers(final User user1, final List<User> others) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __updateAdapterOfUser.handle(_connection, user1);
- __updateAdapterOfUser.handleMultiple(_connection, others);
- return null;
- }
- });
- }
+ @Override
+ public void ageUserByUid(final String uid) {
+ final String _sql = "UPDATE User SET ageColumn = ageColumn + 1 WHERE uid = ?";
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ int _argIndex = 1;
+ if (uid == null) {
+ _stmt.bindNull(_argIndex);
+ } else {
+ _stmt.bindText(_argIndex, uid);
+ }
+ _stmt.step();
+ return null;
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
- @Override
- public void updateArrayOfUsers(final User[] users) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __updateAdapterOfUser.handleMultiple(_connection, users);
- return null;
- }
- });
- }
+ @Override
+ public void ageUserAll() {
+ final String _sql = "UPDATE User SET ageColumn = ageColumn + 1";
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ _stmt.step();
+ return null;
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
- @Override
- public void updateTwoUsers(final User userOne, final User userTwo) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __updateAdapterOfUser_1.handle(_connection, userOne);
- __updateAdapterOfUser_1.handle(_connection, userTwo);
- return null;
- }
- });
- }
-
- @Override
- public int updateUserAndReturnCount(final User user) {
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- int _result = 0;
- _result += __updateAdapterOfUser.handle(_connection, user);
- return _result;
- }
- });
- }
-
- @Override
- public int updateUserAndReturnCount(final User user1, final List<User> others) {
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- int _result = 0;
- _result += __updateAdapterOfUser.handle(_connection, user1);
- _result += __updateAdapterOfUser.handleMultiple(_connection, others);
- return _result;
- }
- });
- }
-
- @Override
- public int updateUserAndReturnCount(final User[] users) {
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- int _result = 0;
- _result += __updateAdapterOfUser.handleMultiple(_connection, users);
- return _result;
- }
- });
- }
-
- @Override
- public Integer updateUserAndReturnCountObject(final User user) {
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- int _result = 0;
- _result += __updateAdapterOfUser.handle(_connection, user);
- return _result;
- }
- });
- }
-
- @Override
- public Completable updateUserAndReturnCountCompletable(final User user) {
- return Completable.fromCallable(new Callable<Void>() {
- @Override
- @Nullable
- public Void call() throws Exception {
- __db.beginTransaction();
- try {
- __updateCompatAdapterOfUser.handle(user);
- __db.setTransactionSuccessful();
- return null;
- } finally {
- __db.endTransaction();
- }
- }
- });
- }
-
- @Override
- public Single<Integer> updateUserAndReturnCountSingle(final User user) {
- return Single.fromCallable(new Callable<Integer>() {
- @Override
- @Nullable
- public Integer call() throws Exception {
- int _total = 0;
- __db.beginTransaction();
- try {
- _total += __updateCompatAdapterOfUser.handle(user);
- __db.setTransactionSuccessful();
- return _total;
- } finally {
- __db.endTransaction();
- }
- }
- });
- }
-
- @Override
- public Maybe<Integer> updateUserAndReturnCountMaybe(final User user) {
- return Maybe.fromCallable(new Callable<Integer>() {
- @Override
- @Nullable
- public Integer call() throws Exception {
- int _total = 0;
- __db.beginTransaction();
- try {
- _total += __updateCompatAdapterOfUser.handle(user);
- __db.setTransactionSuccessful();
- return _total;
- } finally {
- __db.endTransaction();
- }
- }
- });
- }
-
- @Override
- public int multiPKey(final MultiPKeyEntity entity) {
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- int _result = 0;
- _result += __updateAdapterOfMultiPKeyEntity.handle(_connection, entity);
- return _result;
- }
- });
- }
-
- @Override
- public void updateUserAndBook(final User user, final Book book) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __updateAdapterOfUser.handle(_connection, user);
- __updateAdapterOfBook.handle(_connection, book);
- return null;
- }
- });
- }
-
- @Override
- public void updateAndAge(final User user) {
- DBUtil.performBlocking(__db, false, true, (_connection) -> {
- UpdateDao.super.updateAndAge(user);
- return Unit.INSTANCE;
- });
- }
-
- @Override
- public void ageUserByUid(final String uid) {
- final String _sql = "UPDATE User SET ageColumn = ageColumn + 1 WHERE uid = ?";
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- int _argIndex = 1;
- if (uid == null) {
- _stmt.bindNull(_argIndex);
- } else {
- _stmt.bindText(_argIndex, uid);
- }
- _stmt.step();
- return null;
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @Override
- public void ageUserAll() {
+ @Override
+ public Completable ageUserAllCompletable() {
+ return Completable.fromCallable(new Callable<Void>() {
+ @Override
+ @Nullable
+ public Void call() throws Exception {
final String _sql = "UPDATE User SET ageColumn = ageColumn + 1";
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- _stmt.step();
- return null;
- } finally {
- _stmt.close();
- }
- }
- });
- }
+ final SupportSQLiteStatement _stmt = __db.compileStatement(_sql);
+ __db.beginTransaction();
+ try {
+ _stmt.executeUpdateDelete();
+ __db.setTransactionSuccessful();
+ return null;
+ } finally {
+ __db.endTransaction();
+ }
+ }
+ });
+ }
- @Override
- public Completable ageUserAllCompletable() {
- return Completable.fromCallable(new Callable<Void>() {
- @Override
- @Nullable
- public Void call() throws Exception {
- final String _sql = "UPDATE User SET ageColumn = ageColumn + 1";
- final SupportSQLiteStatement _stmt = __db.compileStatement(_sql);
- __db.beginTransaction();
- try {
- _stmt.executeUpdateDelete();
- __db.setTransactionSuccessful();
- return null;
- } finally {
- __db.endTransaction();
- }
- }
- });
- }
+ @Override
+ public Single<Integer> ageUserAllSingle() {
+ return Single.fromCallable(new Callable<Integer>() {
+ @Override
+ @Nullable
+ public Integer call() throws Exception {
+ final String _sql = "UPDATE User SET ageColumn = ageColumn + 1";
+ final SupportSQLiteStatement _stmt = __db.compileStatement(_sql);
+ __db.beginTransaction();
+ try {
+ final Integer _result = _stmt.executeUpdateDelete();
+ __db.setTransactionSuccessful();
+ return _result;
+ } finally {
+ __db.endTransaction();
+ }
+ }
+ });
+ }
- @Override
- public Single<Integer> ageUserAllSingle() {
- return Single.fromCallable(new Callable<Integer>() {
- @Override
- @Nullable
- public Integer call() throws Exception {
- final String _sql = "UPDATE User SET ageColumn = ageColumn + 1";
- final SupportSQLiteStatement _stmt = __db.compileStatement(_sql);
- __db.beginTransaction();
- try {
- final Integer _result = _stmt.executeUpdateDelete();
- __db.setTransactionSuccessful();
- return _result;
- } finally {
- __db.endTransaction();
- }
- }
- });
- }
+ @Override
+ public Maybe<Integer> ageUserAllMaybe() {
+ return Maybe.fromCallable(new Callable<Integer>() {
+ @Override
+ @Nullable
+ public Integer call() throws Exception {
+ final String _sql = "UPDATE User SET ageColumn = ageColumn + 1";
+ final SupportSQLiteStatement _stmt = __db.compileStatement(_sql);
+ __db.beginTransaction();
+ try {
+ final Integer _result = _stmt.executeUpdateDelete();
+ __db.setTransactionSuccessful();
+ return _result;
+ } finally {
+ __db.endTransaction();
+ }
+ }
+ });
+ }
- @Override
- public Maybe<Integer> ageUserAllMaybe() {
- return Maybe.fromCallable(new Callable<Integer>() {
- @Override
- @Nullable
- public Integer call() throws Exception {
- final String _sql = "UPDATE User SET ageColumn = ageColumn + 1";
- final SupportSQLiteStatement _stmt = __db.compileStatement(_sql);
- __db.beginTransaction();
- try {
- final Integer _result = _stmt.executeUpdateDelete();
- __db.setTransactionSuccessful();
- return _result;
- } finally {
- __db.endTransaction();
- }
- }
- });
- }
-
- @NonNull
- public static List<Class<?>> getRequiredConverters() {
- return Collections.emptyList();
- }
-}
\ No newline at end of file
+ @NonNull
+ public static List<Class<?>> getRequiredConverters() {
+ return Collections.emptyList();
+ }
+}
diff --git a/room/room-compiler/src/test/test-data/daoWriter/output/javac/UpsertDao.java b/room/room-compiler/src/test/test-data/daoWriter/output/javac/UpsertDao.java
index 89ad4f4..f6dbf33 100644
--- a/room/room-compiler/src/test/test-data/daoWriter/output/javac/UpsertDao.java
+++ b/room/room-compiler/src/test/test-data/daoWriter/output/javac/UpsertDao.java
@@ -22,175 +22,175 @@
@Generated("androidx.room.RoomProcessor")
@SuppressWarnings({"unchecked", "deprecation", "removal"})
public final class UpsertDao_Impl implements UpsertDao {
- private final RoomDatabase __db;
+ private final RoomDatabase __db;
- private final EntityUpsertAdapter<User> __upsertAdapterOfUser;
+ private final EntityUpsertAdapter<User> __upsertAdapterOfUser;
- private final EntityUpsertAdapter<Book> __upsertAdapterOfBook;
+ private final EntityUpsertAdapter<Book> __upsertAdapterOfBook;
- public UpsertDao_Impl(@NonNull final RoomDatabase __db) {
- this.__db = __db;
- this.__upsertAdapterOfUser = new EntityUpsertAdapter<User>(new EntityInsertAdapter<User>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "INSERT INTO `User` (`uid`,`name`,`lastName`,`ageColumn`) VALUES (?,?,?,?)";
- }
+ public UpsertDao_Impl(@NonNull final RoomDatabase __db) {
+ this.__db = __db;
+ this.__upsertAdapterOfUser = new EntityUpsertAdapter<User>(new EntityInsertAdapter<User>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "INSERT INTO `User` (`uid`,`name`,`lastName`,`ageColumn`) VALUES (?,?,?,?)";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, final User entity) {
- statement.bindLong(1, entity.uid);
- if (entity.name == null) {
- statement.bindNull(2);
- } else {
- statement.bindText(2, entity.name);
- }
- if (entity.getLastName() == null) {
- statement.bindNull(3);
- } else {
- statement.bindText(3, entity.getLastName());
- }
- statement.bindLong(4, entity.age);
- }
- }, new EntityDeleteOrUpdateAdapter<User>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "UPDATE `User` SET `uid` = ?,`name` = ?,`lastName` = ?,`ageColumn` = ? WHERE `uid` = ?";
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, final User entity) {
+ statement.bindLong(1, entity.uid);
+ if (entity.name == null) {
+ statement.bindNull(2);
+ } else {
+ statement.bindText(2, entity.name);
+ }
+ if (entity.getLastName() == null) {
+ statement.bindNull(3);
+ } else {
+ statement.bindText(3, entity.getLastName());
+ }
+ statement.bindLong(4, entity.age);
+ }
+ }, new EntityDeleteOrUpdateAdapter<User>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "UPDATE `User` SET `uid` = ?,`name` = ?,`lastName` = ?,`ageColumn` = ? WHERE `uid` = ?";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, final User entity) {
- statement.bindLong(1, entity.uid);
- if (entity.name == null) {
- statement.bindNull(2);
- } else {
- statement.bindText(2, entity.name);
- }
- if (entity.getLastName() == null) {
- statement.bindNull(3);
- } else {
- statement.bindText(3, entity.getLastName());
- }
- statement.bindLong(4, entity.age);
- statement.bindLong(5, entity.uid);
- }
- });
- this.__upsertAdapterOfBook = new EntityUpsertAdapter<Book>(new EntityInsertAdapter<Book>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "INSERT INTO `Book` (`bookId`,`uid`) VALUES (?,?)";
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, final User entity) {
+ statement.bindLong(1, entity.uid);
+ if (entity.name == null) {
+ statement.bindNull(2);
+ } else {
+ statement.bindText(2, entity.name);
+ }
+ if (entity.getLastName() == null) {
+ statement.bindNull(3);
+ } else {
+ statement.bindText(3, entity.getLastName());
+ }
+ statement.bindLong(4, entity.age);
+ statement.bindLong(5, entity.uid);
+ }
+ });
+ this.__upsertAdapterOfBook = new EntityUpsertAdapter<Book>(new EntityInsertAdapter<Book>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "INSERT INTO `Book` (`bookId`,`uid`) VALUES (?,?)";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, final Book entity) {
- statement.bindLong(1, entity.bookId);
- statement.bindLong(2, entity.uid);
- }
- }, new EntityDeleteOrUpdateAdapter<Book>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "UPDATE `Book` SET `bookId` = ?,`uid` = ? WHERE `bookId` = ?";
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, final Book entity) {
+ statement.bindLong(1, entity.bookId);
+ statement.bindLong(2, entity.uid);
+ }
+ }, new EntityDeleteOrUpdateAdapter<Book>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "UPDATE `Book` SET `bookId` = ?,`uid` = ? WHERE `bookId` = ?";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, final Book entity) {
- statement.bindLong(1, entity.bookId);
- statement.bindLong(2, entity.uid);
- statement.bindLong(3, entity.bookId);
- }
- });
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, final Book entity) {
+ statement.bindLong(1, entity.bookId);
+ statement.bindLong(2, entity.uid);
+ statement.bindLong(3, entity.bookId);
+ }
+ });
+ }
- @Override
- public void upsertUser(final User user) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __upsertAdapterOfUser.upsert(_connection, user);
- return null;
- }
- });
- }
+ @Override
+ public void upsertUser(final User user) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __upsertAdapterOfUser.upsert(_connection, user);
+ return null;
+ }
+ });
+ }
- @Override
- public void upsertUsers(final User user1, final List<User> others) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __upsertAdapterOfUser.upsert(_connection, user1);
- __upsertAdapterOfUser.upsert(_connection, others);
- return null;
- }
- });
- }
+ @Override
+ public void upsertUsers(final User user1, final List<User> others) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __upsertAdapterOfUser.upsert(_connection, user1);
+ __upsertAdapterOfUser.upsert(_connection, others);
+ return null;
+ }
+ });
+ }
- @Override
- public void upsertUsers(final User[] users) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __upsertAdapterOfUser.upsert(_connection, users);
- return null;
- }
- });
- }
+ @Override
+ public void upsertUsers(final User[] users) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __upsertAdapterOfUser.upsert(_connection, users);
+ return null;
+ }
+ });
+ }
- @Override
- public void upsertTwoUsers(final User userOne, final User userTwo) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __upsertAdapterOfUser.upsert(_connection, userOne);
- __upsertAdapterOfUser.upsert(_connection, userTwo);
- return null;
- }
- });
- }
+ @Override
+ public void upsertTwoUsers(final User userOne, final User userTwo) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __upsertAdapterOfUser.upsert(_connection, userOne);
+ __upsertAdapterOfUser.upsert(_connection, userTwo);
+ return null;
+ }
+ });
+ }
- @Override
- public void upsertUserAndBook(final User user, final Book book) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __upsertAdapterOfUser.upsert(_connection, user);
- __upsertAdapterOfBook.upsert(_connection, book);
- return null;
- }
- });
- }
+ @Override
+ public void upsertUserAndBook(final User user, final Book book) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __upsertAdapterOfUser.upsert(_connection, user);
+ __upsertAdapterOfBook.upsert(_connection, book);
+ return null;
+ }
+ });
+ }
- @Override
- public long upsertAndReturnId(final User user) {
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Long>() {
- @Override
- @NonNull
- public Long invoke(@NonNull final SQLiteConnection _connection) {
- return __upsertAdapterOfUser.upsertAndReturnId(_connection, user);
- }
- });
- }
+ @Override
+ public long upsertAndReturnId(final User user) {
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Long>() {
+ @Override
+ @NonNull
+ public Long invoke(@NonNull final SQLiteConnection _connection) {
+ return __upsertAdapterOfUser.upsertAndReturnId(_connection, user);
+ }
+ });
+ }
- @Override
- public long[] upsertAndReturnIdsArray(final User[] users) {
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, long[]>() {
- @Override
- @NonNull
- public long[] invoke(@NonNull final SQLiteConnection _connection) {
- return __upsertAdapterOfUser.upsertAndReturnIdsArray(_connection, users);
- }
- });
- }
+ @Override
+ public long[] upsertAndReturnIdsArray(final User[] users) {
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, long[]>() {
+ @Override
+ @NonNull
+ public long[] invoke(@NonNull final SQLiteConnection _connection) {
+ return __upsertAdapterOfUser.upsertAndReturnIdsArray(_connection, users);
+ }
+ });
+ }
- @NonNull
- public static List<Class<?>> getRequiredConverters() {
- return Collections.emptyList();
- }
-}
\ No newline at end of file
+ @NonNull
+ public static List<Class<?>> getRequiredConverters() {
+ return Collections.emptyList();
+ }
+}
diff --git a/room/room-compiler/src/test/test-data/daoWriter/output/javac/WriterDao.java b/room/room-compiler/src/test/test-data/daoWriter/output/javac/WriterDao.java
index 6bfe333..6402763 100644
--- a/room/room-compiler/src/test/test-data/daoWriter/output/javac/WriterDao.java
+++ b/room/room-compiler/src/test/test-data/daoWriter/output/javac/WriterDao.java
@@ -19,167 +19,167 @@
@Generated("androidx.room.RoomProcessor")
@SuppressWarnings({"unchecked", "deprecation", "removal"})
public final class WriterDao_Impl implements WriterDao {
- private final RoomDatabase __db;
+ private final RoomDatabase __db;
- private final EntityInsertAdapter<User> __insertAdapterOfUser;
+ private final EntityInsertAdapter<User> __insertAdapterOfUser;
- private final EntityInsertAdapter<User> __insertAdapterOfUser_1;
+ private final EntityInsertAdapter<User> __insertAdapterOfUser_1;
- private final EntityInsertAdapter<User> __insertAdapterOfUser_2;
+ private final EntityInsertAdapter<User> __insertAdapterOfUser_2;
- private final EntityInsertAdapter<Book> __insertAdapterOfBook;
+ private final EntityInsertAdapter<Book> __insertAdapterOfBook;
- public WriterDao_Impl(@NonNull final RoomDatabase __db) {
- this.__db = __db;
- this.__insertAdapterOfUser = new EntityInsertAdapter<User>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "INSERT OR ABORT INTO `User` (`uid`,`name`,`lastName`,`ageColumn`) VALUES (?,?,?,?)";
- }
+ public WriterDao_Impl(@NonNull final RoomDatabase __db) {
+ this.__db = __db;
+ this.__insertAdapterOfUser = new EntityInsertAdapter<User>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "INSERT OR ABORT INTO `User` (`uid`,`name`,`lastName`,`ageColumn`) VALUES (?,?,?,?)";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, final User entity) {
- statement.bindLong(1, entity.uid);
- if (entity.name == null) {
- statement.bindNull(2);
- } else {
- statement.bindText(2, entity.name);
- }
- if (entity.getLastName() == null) {
- statement.bindNull(3);
- } else {
- statement.bindText(3, entity.getLastName());
- }
- statement.bindLong(4, entity.age);
- }
- };
- this.__insertAdapterOfUser_1 = new EntityInsertAdapter<User>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "INSERT OR REPLACE INTO `User` (`uid`,`name`,`lastName`,`ageColumn`) VALUES (?,?,?,?)";
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, final User entity) {
+ statement.bindLong(1, entity.uid);
+ if (entity.name == null) {
+ statement.bindNull(2);
+ } else {
+ statement.bindText(2, entity.name);
+ }
+ if (entity.getLastName() == null) {
+ statement.bindNull(3);
+ } else {
+ statement.bindText(3, entity.getLastName());
+ }
+ statement.bindLong(4, entity.age);
+ }
+ };
+ this.__insertAdapterOfUser_1 = new EntityInsertAdapter<User>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "INSERT OR REPLACE INTO `User` (`uid`,`name`,`lastName`,`ageColumn`) VALUES (?,?,?,?)";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, final User entity) {
- statement.bindLong(1, entity.uid);
- if (entity.name == null) {
- statement.bindNull(2);
- } else {
- statement.bindText(2, entity.name);
- }
- if (entity.getLastName() == null) {
- statement.bindNull(3);
- } else {
- statement.bindText(3, entity.getLastName());
- }
- statement.bindLong(4, entity.age);
- }
- };
- this.__insertAdapterOfUser_2 = new EntityInsertAdapter<User>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "INSERT INTO `User` (`uid`,`name`,`lastName`,`ageColumn`) VALUES (?,?,?,?)";
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, final User entity) {
+ statement.bindLong(1, entity.uid);
+ if (entity.name == null) {
+ statement.bindNull(2);
+ } else {
+ statement.bindText(2, entity.name);
+ }
+ if (entity.getLastName() == null) {
+ statement.bindNull(3);
+ } else {
+ statement.bindText(3, entity.getLastName());
+ }
+ statement.bindLong(4, entity.age);
+ }
+ };
+ this.__insertAdapterOfUser_2 = new EntityInsertAdapter<User>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "INSERT INTO `User` (`uid`,`name`,`lastName`,`ageColumn`) VALUES (?,?,?,?)";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, final User entity) {
- statement.bindLong(1, entity.uid);
- if (entity.name == null) {
- statement.bindNull(2);
- } else {
- statement.bindText(2, entity.name);
- }
- if (entity.getLastName() == null) {
- statement.bindNull(3);
- } else {
- statement.bindText(3, entity.getLastName());
- }
- statement.bindLong(4, entity.age);
- }
- };
- this.__insertAdapterOfBook = new EntityInsertAdapter<Book>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "INSERT OR ABORT INTO `Book` (`bookId`,`uid`) VALUES (?,?)";
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, final User entity) {
+ statement.bindLong(1, entity.uid);
+ if (entity.name == null) {
+ statement.bindNull(2);
+ } else {
+ statement.bindText(2, entity.name);
+ }
+ if (entity.getLastName() == null) {
+ statement.bindNull(3);
+ } else {
+ statement.bindText(3, entity.getLastName());
+ }
+ statement.bindLong(4, entity.age);
+ }
+ };
+ this.__insertAdapterOfBook = new EntityInsertAdapter<Book>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "INSERT OR ABORT INTO `Book` (`bookId`,`uid`) VALUES (?,?)";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, final Book entity) {
- statement.bindLong(1, entity.bookId);
- statement.bindLong(2, entity.uid);
- }
- };
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, final Book entity) {
+ statement.bindLong(1, entity.bookId);
+ statement.bindLong(2, entity.uid);
+ }
+ };
+ }
- @Override
- public void insertUser(final User user) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __insertAdapterOfUser.insert(_connection, user);
- return null;
- }
- });
- }
+ @Override
+ public void insertUser(final User user) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __insertAdapterOfUser.insert(_connection, user);
+ return null;
+ }
+ });
+ }
- @Override
- public void insertUsers(final User user1, final List<User> others) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __insertAdapterOfUser.insert(_connection, user1);
- __insertAdapterOfUser.insert(_connection, others);
- return null;
- }
- });
- }
+ @Override
+ public void insertUsers(final User user1, final List<User> others) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __insertAdapterOfUser.insert(_connection, user1);
+ __insertAdapterOfUser.insert(_connection, others);
+ return null;
+ }
+ });
+ }
- @Override
- public void insertUsers(final User[] users) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __insertAdapterOfUser_1.insert(_connection, users);
- return null;
- }
- });
- }
+ @Override
+ public void insertUsers(final User[] users) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __insertAdapterOfUser_1.insert(_connection, users);
+ return null;
+ }
+ });
+ }
- @Override
- public void insertTwoUsers(final User userOne, final User userTwo) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __insertAdapterOfUser_2.insert(_connection, userOne);
- __insertAdapterOfUser_2.insert(_connection, userTwo);
- return null;
- }
- });
- }
+ @Override
+ public void insertTwoUsers(final User userOne, final User userTwo) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __insertAdapterOfUser_2.insert(_connection, userOne);
+ __insertAdapterOfUser_2.insert(_connection, userTwo);
+ return null;
+ }
+ });
+ }
- @Override
- public void insertUserAndBook(final User user, final Book book) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __insertAdapterOfUser.insert(_connection, user);
- __insertAdapterOfBook.insert(_connection, book);
- return null;
- }
- });
- }
+ @Override
+ public void insertUserAndBook(final User user, final Book book) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __insertAdapterOfUser.insert(_connection, user);
+ __insertAdapterOfBook.insert(_connection, book);
+ return null;
+ }
+ });
+ }
- @NonNull
- public static List<Class<?>> getRequiredConverters() {
- return Collections.emptyList();
- }
-}
\ No newline at end of file
+ @NonNull
+ public static List<Class<?>> getRequiredConverters() {
+ return Collections.emptyList();
+ }
+}
diff --git a/room/room-compiler/src/test/test-data/daoWriter/output/ksp/ComplexDao.java b/room/room-compiler/src/test/test-data/daoWriter/output/ksp/ComplexDao.java
index 275e55d..0119011 100644
--- a/room/room-compiler/src/test/test-data/daoWriter/output/ksp/ComplexDao.java
+++ b/room/room-compiler/src/test/test-data/daoWriter/output/ksp/ComplexDao.java
@@ -33,635 +33,635 @@
@Generated("androidx.room.RoomProcessor")
@SuppressWarnings({"unchecked", "deprecation", "removal"})
public final class ComplexDao_Impl extends ComplexDao {
- private final RoomDatabase __db;
+ private final RoomDatabase __db;
- public ComplexDao_Impl(final ComplexDatabase __db) {
- super(__db);
- this.__db = __db;
- }
+ public ComplexDao_Impl(final ComplexDatabase __db) {
+ super(__db);
+ this.__db = __db;
+ }
- @Override
- public boolean transactionMethod(final int i, final String s, final long l) {
- return DBUtil.performBlocking(__db, false, true, (_connection) -> {
- return ComplexDao_Impl.super.transactionMethod(i, s, l);
+ @Override
+ public boolean transactionMethod(final int i, final String s, final long l) {
+ return DBUtil.performBlocking(__db, false, true, (_connection) -> {
+ return ComplexDao_Impl.super.transactionMethod(i, s, l);
});
- }
+ }
- @Override
- public List<ComplexDao.FullName> fullNames(final int id) {
- final String _sql = "SELECT name || lastName as fullName, uid as id FROM user where uid = ?";
- return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<ComplexDao.FullName>>() {
- @Override
- @NonNull
- public List<ComplexDao.FullName> invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- int _argIndex = 1;
- _stmt.bindLong(_argIndex, id);
- final int _cursorIndexOfFullName = 0;
- final int _cursorIndexOfId = 1;
- final List<ComplexDao.FullName> _result = new ArrayList<ComplexDao.FullName>();
- while (_stmt.step()) {
- final ComplexDao.FullName _item;
- _item = new ComplexDao.FullName();
- _item.fullName = _stmt.getText(_cursorIndexOfFullName);
- _item.id = (int) (_stmt.getLong(_cursorIndexOfId));
- _result.add(_item);
- }
- return _result;
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @Override
- public User getById(final int id) {
- final String _sql = "SELECT * FROM user where uid = ?";
- return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, User>() {
- @Override
- @NonNull
- public User invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- int _argIndex = 1;
- _stmt.bindLong(_argIndex, id);
- final int _cursorIndexOfUid = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "uid");
- final int _cursorIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name");
- final int _cursorIndexOfLastName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "lastName");
- final int _cursorIndexOfAge = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "ageColumn");
- final User _result;
- if (_stmt.step()) {
- _result = new User();
- _result.uid = (int) (_stmt.getLong(_cursorIndexOfUid));
- _result.name = _stmt.getText(_cursorIndexOfName);
- final String _tmpLastName;
- _tmpLastName = _stmt.getText(_cursorIndexOfLastName);
- _result.setLastName(_tmpLastName);
- _result.age = (int) (_stmt.getLong(_cursorIndexOfAge));
- } else {
- _result = null;
- }
- return _result;
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @Override
- public User findByName(final String name, final String lastName) {
- final String _sql = "SELECT * FROM user where name LIKE ? AND lastName LIKE ?";
- return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, User>() {
- @Override
- @NonNull
- public User invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- int _argIndex = 1;
- _stmt.bindText(_argIndex, name);
- _argIndex = 2;
- _stmt.bindText(_argIndex, lastName);
- final int _cursorIndexOfUid = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "uid");
- final int _cursorIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name");
- final int _cursorIndexOfLastName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "lastName");
- final int _cursorIndexOfAge = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "ageColumn");
- final User _result;
- if (_stmt.step()) {
- _result = new User();
- _result.uid = (int) (_stmt.getLong(_cursorIndexOfUid));
- _result.name = _stmt.getText(_cursorIndexOfName);
- final String _tmpLastName;
- _tmpLastName = _stmt.getText(_cursorIndexOfLastName);
- _result.setLastName(_tmpLastName);
- _result.age = (int) (_stmt.getLong(_cursorIndexOfAge));
- } else {
- _result = null;
- }
- return _result;
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @Override
- public List<User> loadAllByIds(final int... ids) {
- final StringBuilder _stringBuilder = new StringBuilder();
- _stringBuilder.append("SELECT * FROM user where uid IN (");
- final int _inputSize = ids == null ? 1 : ids.length;
- StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
- _stringBuilder.append(")");
- final String _sql = _stringBuilder.toString();
- return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<User>>() {
- @Override
- @NonNull
- public List<User> invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- int _argIndex = 1;
- if (ids == null) {
- _stmt.bindNull(_argIndex);
- } else {
- for (int _item : ids) {
- _stmt.bindLong(_argIndex, _item);
- _argIndex++;
- }
- }
- final int _cursorIndexOfUid = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "uid");
- final int _cursorIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name");
- final int _cursorIndexOfLastName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "lastName");
- final int _cursorIndexOfAge = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "ageColumn");
- final List<User> _result = new ArrayList<User>();
- while (_stmt.step()) {
- final User _item_1;
- _item_1 = new User();
- _item_1.uid = (int) (_stmt.getLong(_cursorIndexOfUid));
- _item_1.name = _stmt.getText(_cursorIndexOfName);
- final String _tmpLastName;
- _tmpLastName = _stmt.getText(_cursorIndexOfLastName);
- _item_1.setLastName(_tmpLastName);
- _item_1.age = (int) (_stmt.getLong(_cursorIndexOfAge));
- _result.add(_item_1);
- }
- return _result;
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @Override
- int getAge(final int id) {
- final String _sql = "SELECT ageColumn FROM user where uid = ?";
- return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- int _argIndex = 1;
- _stmt.bindLong(_argIndex, id);
- final int _result;
- if (_stmt.step()) {
- _result = (int) (_stmt.getLong(0));
- } else {
- _result = 0;
- }
- return _result;
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @Override
- public int[] getAllAges(final int... ids) {
- final StringBuilder _stringBuilder = new StringBuilder();
- _stringBuilder.append("SELECT ageColumn FROM user where uid IN(");
- final int _inputSize = ids == null ? 1 : ids.length;
- StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
- _stringBuilder.append(")");
- final String _sql = _stringBuilder.toString();
- return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, int[]>() {
- @Override
- @NonNull
- public int[] invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- int _argIndex = 1;
- if (ids == null) {
- _stmt.bindNull(_argIndex);
- } else {
- for (int _item : ids) {
- _stmt.bindLong(_argIndex, _item);
- _argIndex++;
- }
- }
- final List<Integer> _listResult = new ArrayList<Integer>();
- while (_stmt.step()) {
- final Integer _item_1;
- _item_1 = (int) (_stmt.getLong(0));
- _listResult.add(_item_1);
- }
- final int[] _tmpArrayResult = new int[_listResult.size()];
- int _index = 0;
- for (int _listItem : _listResult) {
- _tmpArrayResult[_index] = _listItem;
- _index++;
- }
- final int[] _result = _tmpArrayResult;
- return _result;
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @Override
- public List<Integer> getAllAgesAsList(final List<Integer> ids) {
- final StringBuilder _stringBuilder = new StringBuilder();
- _stringBuilder.append("SELECT ageColumn FROM user where uid IN(");
- final int _inputSize = ids == null ? 1 : ids.size();
- StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
- _stringBuilder.append(")");
- final String _sql = _stringBuilder.toString();
- return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<Integer>>() {
- @Override
- @NonNull
- public List<Integer> invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- int _argIndex = 1;
- if (ids == null) {
- _stmt.bindNull(_argIndex);
- } else {
- for (Integer _item : ids) {
- if (_item == null) {
- _stmt.bindNull(_argIndex);
- } else {
- _stmt.bindLong(_argIndex, _item);
- }
- _argIndex++;
- }
- }
- final List<Integer> _result = new ArrayList<Integer>();
- while (_stmt.step()) {
- final Integer _item_1;
- if (_stmt.isNull(0)) {
- _item_1 = null;
- } else {
- _item_1 = (int) (_stmt.getLong(0));
- }
- _result.add(_item_1);
- }
- return _result;
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @Override
- public List<Integer> getAllAgesAsList(final List<Integer> ids1, final int[] ids2,
- final int... ids3) {
- final StringBuilder _stringBuilder = new StringBuilder();
- _stringBuilder.append("SELECT ageColumn FROM user where uid IN(");
- final int _inputSize = ids1 == null ? 1 : ids1.size();
- StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
- _stringBuilder.append(") OR uid IN (");
- final int _inputSize_1 = ids2 == null ? 1 : ids2.length;
- StringUtil.appendPlaceholders(_stringBuilder, _inputSize_1);
- _stringBuilder.append(") OR uid IN (");
- final int _inputSize_2 = ids3 == null ? 1 : ids3.length;
- StringUtil.appendPlaceholders(_stringBuilder, _inputSize_2);
- _stringBuilder.append(")");
- final String _sql = _stringBuilder.toString();
- return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<Integer>>() {
- @Override
- @NonNull
- public List<Integer> invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- int _argIndex = 1;
- if (ids1 == null) {
- _stmt.bindNull(_argIndex);
- } else {
- for (Integer _item : ids1) {
- if (_item == null) {
- _stmt.bindNull(_argIndex);
- } else {
- _stmt.bindLong(_argIndex, _item);
- }
- _argIndex++;
- }
- }
- _argIndex = 1 + _inputSize;
- if (ids2 == null) {
- _stmt.bindNull(_argIndex);
- } else {
- for (int _item_1 : ids2) {
- _stmt.bindLong(_argIndex, _item_1);
- _argIndex++;
- }
- }
- _argIndex = 1 + _inputSize + _inputSize_1;
- if (ids3 == null) {
- _stmt.bindNull(_argIndex);
- } else {
- for (int _item_2 : ids3) {
- _stmt.bindLong(_argIndex, _item_2);
- _argIndex++;
- }
- }
- final List<Integer> _result = new ArrayList<Integer>();
- while (_stmt.step()) {
- final Integer _item_3;
- if (_stmt.isNull(0)) {
- _item_3 = null;
- } else {
- _item_3 = (int) (_stmt.getLong(0));
- }
- _result.add(_item_3);
- }
- return _result;
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @Override
- public LiveData<User> getByIdLive(final int id) {
- final String _sql = "SELECT * FROM user where uid = ?";
- final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 1);
- int _argIndex = 1;
- _statement.bindLong(_argIndex, id);
- return __db.getInvalidationTracker().createLiveData(new String[] {"user"}, false, new Callable<User>() {
- @Override
- @Nullable
- public User call() throws Exception {
- final Cursor _cursor = DBUtil.query(__db, _statement, false, null);
- try {
- final int _cursorIndexOfUid = CursorUtil.getColumnIndexOrThrow(_cursor, "uid");
- final int _cursorIndexOfName = CursorUtil.getColumnIndexOrThrow(_cursor, "name");
- final int _cursorIndexOfLastName = CursorUtil.getColumnIndexOrThrow(_cursor, "lastName");
- final int _cursorIndexOfAge = CursorUtil.getColumnIndexOrThrow(_cursor, "ageColumn");
- final User _result;
- if (_cursor.moveToFirst()) {
- _result = new User();
- _result.uid = _cursor.getInt(_cursorIndexOfUid);
- _result.name = _cursor.getString(_cursorIndexOfName);
- final String _tmpLastName;
- _tmpLastName = _cursor.getString(_cursorIndexOfLastName);
- _result.setLastName(_tmpLastName);
- _result.age = _cursor.getInt(_cursorIndexOfAge);
- } else {
- _result = null;
- }
- return _result;
- } finally {
- _cursor.close();
- }
- }
-
- @Override
- protected void finalize() {
- _statement.release();
- }
- });
- }
-
- @Override
- public LiveData<List<User>> loadUsersByIdsLive(final int... ids) {
- final StringBuilder _stringBuilder = new StringBuilder();
- _stringBuilder.append("SELECT * FROM user where uid IN (");
- final int _inputSize = ids == null ? 1 : ids.length;
- StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
- _stringBuilder.append(")");
- final String _sql = _stringBuilder.toString();
- final int _argCount = 0 + _inputSize;
- final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, _argCount);
- int _argIndex = 1;
- if (ids == null) {
- _statement.bindNull(_argIndex);
- } else {
- for (int _item : ids) {
- _statement.bindLong(_argIndex, _item);
- _argIndex++;
- }
- }
- return __db.getInvalidationTracker().createLiveData(new String[] {"user"}, false, new Callable<List<User>>() {
- @Override
- @Nullable
- public List<User> call() throws Exception {
- final Cursor _cursor = DBUtil.query(__db, _statement, false, null);
- try {
- final int _cursorIndexOfUid = CursorUtil.getColumnIndexOrThrow(_cursor, "uid");
- final int _cursorIndexOfName = CursorUtil.getColumnIndexOrThrow(_cursor, "name");
- final int _cursorIndexOfLastName = CursorUtil.getColumnIndexOrThrow(_cursor, "lastName");
- final int _cursorIndexOfAge = CursorUtil.getColumnIndexOrThrow(_cursor, "ageColumn");
- final List<User> _result = new ArrayList<User>();
- while (_cursor.moveToNext()) {
- final User _item_1;
- _item_1 = new User();
- _item_1.uid = _cursor.getInt(_cursorIndexOfUid);
- _item_1.name = _cursor.getString(_cursorIndexOfName);
- final String _tmpLastName;
- _tmpLastName = _cursor.getString(_cursorIndexOfLastName);
- _item_1.setLastName(_tmpLastName);
- _item_1.age = _cursor.getInt(_cursorIndexOfAge);
- _result.add(_item_1);
- }
- return _result;
- } finally {
- _cursor.close();
- }
- }
-
- @Override
- protected void finalize() {
- _statement.release();
- }
- });
- }
-
- @Override
- public List<Child1> getChild1List() {
- final String _sql = "SELECT * FROM Child1";
- return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<Child1>>() {
- @Override
- @NonNull
- public List<Child1> invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- final int _cursorIndexOfId = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "id");
- final int _cursorIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name");
- final int _cursorIndexOfSerial = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "serial");
- final int _cursorIndexOfCode = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "code");
- final List<Child1> _result = new ArrayList<Child1>();
- while (_stmt.step()) {
- final Child1 _item;
- final int _tmpId;
- _tmpId = (int) (_stmt.getLong(_cursorIndexOfId));
- final String _tmpName;
- _tmpName = _stmt.getText(_cursorIndexOfName);
- final Info _tmpInfo;
- if (!(_stmt.isNull(_cursorIndexOfSerial) && _stmt.isNull(_cursorIndexOfCode))) {
- _tmpInfo = new Info();
- _tmpInfo.serial = (int) (_stmt.getLong(_cursorIndexOfSerial));
- _tmpInfo.code = _stmt.getText(_cursorIndexOfCode);
- } else {
- _tmpInfo = null;
- }
- _item = new Child1(_tmpId,_tmpName,_tmpInfo);
- _result.add(_item);
- }
- return _result;
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @Override
- public List<Child2> getChild2List() {
- final String _sql = "SELECT * FROM Child2";
- return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<Child2>>() {
- @Override
- @NonNull
- public List<Child2> invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- final int _cursorIndexOfId = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "id");
- final int _cursorIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name");
- final int _cursorIndexOfSerial = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "serial");
- final int _cursorIndexOfCode = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "code");
- final List<Child2> _result = new ArrayList<Child2>();
- while (_stmt.step()) {
- final Child2 _item;
- final int _tmpId;
- _tmpId = (int) (_stmt.getLong(_cursorIndexOfId));
- final String _tmpName;
- _tmpName = _stmt.getText(_cursorIndexOfName);
- final Info _tmpInfo;
- if (!(_stmt.isNull(_cursorIndexOfSerial) && _stmt.isNull(_cursorIndexOfCode))) {
- _tmpInfo = new Info();
- _tmpInfo.serial = (int) (_stmt.getLong(_cursorIndexOfSerial));
- _tmpInfo.code = _stmt.getText(_cursorIndexOfCode);
- } else {
- _tmpInfo = null;
- }
- _item = new Child2(_tmpId,_tmpName,_tmpInfo);
- _result.add(_item);
- }
- return _result;
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @Override
- public ListenableFuture<List<Child1>> getChild1ListListenableFuture() {
- final String _sql = "SELECT * FROM Child1";
- final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 0);
- final CancellationSignal _cancellationSignal = new CancellationSignal();
- return GuavaRoom.createListenableFuture(__db, false, new Callable<List<Child1>>() {
- @Override
- public List<Child1> call() throws Exception {
- final Cursor _cursor = DBUtil.query(__db, _statement, false, _cancellationSignal);
- try {
- final int _cursorIndexOfId = CursorUtil.getColumnIndexOrThrow(_cursor, "id");
- final int _cursorIndexOfName = CursorUtil.getColumnIndexOrThrow(_cursor, "name");
- final int _cursorIndexOfSerial = CursorUtil.getColumnIndexOrThrow(_cursor, "serial");
- final int _cursorIndexOfCode = CursorUtil.getColumnIndexOrThrow(_cursor, "code");
- final List<Child1> _result = new ArrayList<Child1>();
- while (_cursor.moveToNext()) {
- final Child1 _item;
- final int _tmpId;
- _tmpId = _cursor.getInt(_cursorIndexOfId);
- final String _tmpName;
- _tmpName = _cursor.getString(_cursorIndexOfName);
- final Info _tmpInfo;
- if (!(_cursor.isNull(_cursorIndexOfSerial) && _cursor.isNull(_cursorIndexOfCode))) {
- _tmpInfo = new Info();
- _tmpInfo.serial = _cursor.getInt(_cursorIndexOfSerial);
- _tmpInfo.code = _cursor.getString(_cursorIndexOfCode);
- } else {
- _tmpInfo = null;
- }
- _item = new Child1(_tmpId,_tmpName,_tmpInfo);
- _result.add(_item);
- }
- return _result;
- } finally {
- _cursor.close();
- }
- }
- }, _statement, true, _cancellationSignal);
- }
-
- @Override
- public List<UserSummary> getUserNames() {
- final String _sql = "SELECT `uid`, `name` FROM (SELECT * FROM User)";
- return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<UserSummary>>() {
- @Override
- @NonNull
- public List<UserSummary> invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- final int _cursorIndexOfUid = 0;
- final int _cursorIndexOfName = 1;
- final List<UserSummary> _result = new ArrayList<UserSummary>();
- while (_stmt.step()) {
- final UserSummary _item;
- _item = new UserSummary();
- _item.uid = (int) (_stmt.getLong(_cursorIndexOfUid));
- _item.name = _stmt.getText(_cursorIndexOfName);
- _result.add(_item);
- }
- return _result;
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @Override
- public User getUserViaRawQuery(final SupportSQLiteQuery rawQuery) {
- __db.assertNotSuspendingTransaction();
- final Cursor _cursor = DBUtil.query(__db, rawQuery, false, null);
+ @Override
+ public List<ComplexDao.FullName> fullNames(final int id) {
+ final String _sql = "SELECT name || lastName as fullName, uid as id FROM user where uid = ?";
+ return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<ComplexDao.FullName>>() {
+ @Override
+ @NonNull
+ public List<ComplexDao.FullName> invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
try {
- final User _result;
- if (_cursor.moveToFirst()) {
- _result = __entityCursorConverter_fooBarUser(_cursor);
- } else {
- _result = null;
- }
- return _result;
+ int _argIndex = 1;
+ _stmt.bindLong(_argIndex, id);
+ final int _cursorIndexOfFullName = 0;
+ final int _cursorIndexOfId = 1;
+ final List<ComplexDao.FullName> _result = new ArrayList<ComplexDao.FullName>();
+ while (_stmt.step()) {
+ final ComplexDao.FullName _item;
+ _item = new ComplexDao.FullName();
+ _item.fullName = _stmt.getText(_cursorIndexOfFullName);
+ _item.id = (int) (_stmt.getLong(_cursorIndexOfId));
+ _result.add(_item);
+ }
+ return _result;
} finally {
- _cursor.close();
+ _stmt.close();
}
- }
+ }
+ });
+ }
- @NonNull
- public static List<Class<?>> getRequiredConverters() {
- return Collections.emptyList();
- }
-
- private User __entityCursorConverter_fooBarUser(@NonNull final Cursor cursor) {
- final User _entity;
- final int _cursorIndexOfUid = CursorUtil.getColumnIndex(cursor, "uid");
- final int _cursorIndexOfName = CursorUtil.getColumnIndex(cursor, "name");
- final int _cursorIndexOfLastName = CursorUtil.getColumnIndex(cursor, "lastName");
- final int _cursorIndexOfAge = CursorUtil.getColumnIndex(cursor, "ageColumn");
- _entity = new User();
- if (_cursorIndexOfUid != -1) {
- _entity.uid = cursor.getInt(_cursorIndexOfUid);
- }
- if (_cursorIndexOfName != -1) {
- _entity.name = cursor.getString(_cursorIndexOfName);
- }
- if (_cursorIndexOfLastName != -1) {
+ @Override
+ public User getById(final int id) {
+ final String _sql = "SELECT * FROM user where uid = ?";
+ return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, User>() {
+ @Override
+ @NonNull
+ public User invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ int _argIndex = 1;
+ _stmt.bindLong(_argIndex, id);
+ final int _cursorIndexOfUid = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "uid");
+ final int _cursorIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name");
+ final int _cursorIndexOfLastName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "lastName");
+ final int _cursorIndexOfAge = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "ageColumn");
+ final User _result;
+ if (_stmt.step()) {
+ _result = new User();
+ _result.uid = (int) (_stmt.getLong(_cursorIndexOfUid));
+ _result.name = _stmt.getText(_cursorIndexOfName);
final String _tmpLastName;
- _tmpLastName = cursor.getString(_cursorIndexOfLastName);
- _entity.setLastName(_tmpLastName);
+ _tmpLastName = _stmt.getText(_cursorIndexOfLastName);
+ _result.setLastName(_tmpLastName);
+ _result.age = (int) (_stmt.getLong(_cursorIndexOfAge));
+ } else {
+ _result = null;
+ }
+ return _result;
+ } finally {
+ _stmt.close();
}
- if (_cursorIndexOfAge != -1) {
- _entity.age = cursor.getInt(_cursorIndexOfAge);
+ }
+ });
+ }
+
+ @Override
+ public User findByName(final String name, final String lastName) {
+ final String _sql = "SELECT * FROM user where name LIKE ? AND lastName LIKE ?";
+ return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, User>() {
+ @Override
+ @NonNull
+ public User invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ int _argIndex = 1;
+ _stmt.bindText(_argIndex, name);
+ _argIndex = 2;
+ _stmt.bindText(_argIndex, lastName);
+ final int _cursorIndexOfUid = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "uid");
+ final int _cursorIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name");
+ final int _cursorIndexOfLastName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "lastName");
+ final int _cursorIndexOfAge = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "ageColumn");
+ final User _result;
+ if (_stmt.step()) {
+ _result = new User();
+ _result.uid = (int) (_stmt.getLong(_cursorIndexOfUid));
+ _result.name = _stmt.getText(_cursorIndexOfName);
+ final String _tmpLastName;
+ _tmpLastName = _stmt.getText(_cursorIndexOfLastName);
+ _result.setLastName(_tmpLastName);
+ _result.age = (int) (_stmt.getLong(_cursorIndexOfAge));
+ } else {
+ _result = null;
+ }
+ return _result;
+ } finally {
+ _stmt.close();
}
- return _entity;
+ }
+ });
+ }
+
+ @Override
+ public List<User> loadAllByIds(final int... ids) {
+ final StringBuilder _stringBuilder = new StringBuilder();
+ _stringBuilder.append("SELECT * FROM user where uid IN (");
+ final int _inputSize = ids == null ? 1 : ids.length;
+ StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
+ _stringBuilder.append(")");
+ final String _sql = _stringBuilder.toString();
+ return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<User>>() {
+ @Override
+ @NonNull
+ public List<User> invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ int _argIndex = 1;
+ if (ids == null) {
+ _stmt.bindNull(_argIndex);
+ } else {
+ for (int _item : ids) {
+ _stmt.bindLong(_argIndex, _item);
+ _argIndex++;
+ }
+ }
+ final int _cursorIndexOfUid = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "uid");
+ final int _cursorIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name");
+ final int _cursorIndexOfLastName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "lastName");
+ final int _cursorIndexOfAge = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "ageColumn");
+ final List<User> _result = new ArrayList<User>();
+ while (_stmt.step()) {
+ final User _item_1;
+ _item_1 = new User();
+ _item_1.uid = (int) (_stmt.getLong(_cursorIndexOfUid));
+ _item_1.name = _stmt.getText(_cursorIndexOfName);
+ final String _tmpLastName;
+ _tmpLastName = _stmt.getText(_cursorIndexOfLastName);
+ _item_1.setLastName(_tmpLastName);
+ _item_1.age = (int) (_stmt.getLong(_cursorIndexOfAge));
+ _result.add(_item_1);
+ }
+ return _result;
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
+
+ @Override
+ int getAge(final int id) {
+ final String _sql = "SELECT ageColumn FROM user where uid = ?";
+ return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ int _argIndex = 1;
+ _stmt.bindLong(_argIndex, id);
+ final int _result;
+ if (_stmt.step()) {
+ _result = (int) (_stmt.getLong(0));
+ } else {
+ _result = 0;
+ }
+ return _result;
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
+
+ @Override
+ public int[] getAllAges(final int... ids) {
+ final StringBuilder _stringBuilder = new StringBuilder();
+ _stringBuilder.append("SELECT ageColumn FROM user where uid IN(");
+ final int _inputSize = ids == null ? 1 : ids.length;
+ StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
+ _stringBuilder.append(")");
+ final String _sql = _stringBuilder.toString();
+ return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, int[]>() {
+ @Override
+ @NonNull
+ public int[] invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ int _argIndex = 1;
+ if (ids == null) {
+ _stmt.bindNull(_argIndex);
+ } else {
+ for (int _item : ids) {
+ _stmt.bindLong(_argIndex, _item);
+ _argIndex++;
+ }
+ }
+ final List<Integer> _listResult = new ArrayList<Integer>();
+ while (_stmt.step()) {
+ final Integer _item_1;
+ _item_1 = (int) (_stmt.getLong(0));
+ _listResult.add(_item_1);
+ }
+ final int[] _tmpArrayResult = new int[_listResult.size()];
+ int _index = 0;
+ for (int _listItem : _listResult) {
+ _tmpArrayResult[_index] = _listItem;
+ _index++;
+ }
+ final int[] _result = _tmpArrayResult;
+ return _result;
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
+
+ @Override
+ public List<Integer> getAllAgesAsList(final List<Integer> ids) {
+ final StringBuilder _stringBuilder = new StringBuilder();
+ _stringBuilder.append("SELECT ageColumn FROM user where uid IN(");
+ final int _inputSize = ids == null ? 1 : ids.size();
+ StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
+ _stringBuilder.append(")");
+ final String _sql = _stringBuilder.toString();
+ return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<Integer>>() {
+ @Override
+ @NonNull
+ public List<Integer> invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ int _argIndex = 1;
+ if (ids == null) {
+ _stmt.bindNull(_argIndex);
+ } else {
+ for (Integer _item : ids) {
+ if (_item == null) {
+ _stmt.bindNull(_argIndex);
+ } else {
+ _stmt.bindLong(_argIndex, _item);
+ }
+ _argIndex++;
+ }
+ }
+ final List<Integer> _result = new ArrayList<Integer>();
+ while (_stmt.step()) {
+ final Integer _item_1;
+ if (_stmt.isNull(0)) {
+ _item_1 = null;
+ } else {
+ _item_1 = (int) (_stmt.getLong(0));
+ }
+ _result.add(_item_1);
+ }
+ return _result;
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
+
+ @Override
+ public List<Integer> getAllAgesAsList(final List<Integer> ids1, final int[] ids2,
+ final int... ids3) {
+ final StringBuilder _stringBuilder = new StringBuilder();
+ _stringBuilder.append("SELECT ageColumn FROM user where uid IN(");
+ final int _inputSize = ids1 == null ? 1 : ids1.size();
+ StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
+ _stringBuilder.append(") OR uid IN (");
+ final int _inputSize_1 = ids2 == null ? 1 : ids2.length;
+ StringUtil.appendPlaceholders(_stringBuilder, _inputSize_1);
+ _stringBuilder.append(") OR uid IN (");
+ final int _inputSize_2 = ids3 == null ? 1 : ids3.length;
+ StringUtil.appendPlaceholders(_stringBuilder, _inputSize_2);
+ _stringBuilder.append(")");
+ final String _sql = _stringBuilder.toString();
+ return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<Integer>>() {
+ @Override
+ @NonNull
+ public List<Integer> invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ int _argIndex = 1;
+ if (ids1 == null) {
+ _stmt.bindNull(_argIndex);
+ } else {
+ for (Integer _item : ids1) {
+ if (_item == null) {
+ _stmt.bindNull(_argIndex);
+ } else {
+ _stmt.bindLong(_argIndex, _item);
+ }
+ _argIndex++;
+ }
+ }
+ _argIndex = 1 + _inputSize;
+ if (ids2 == null) {
+ _stmt.bindNull(_argIndex);
+ } else {
+ for (int _item_1 : ids2) {
+ _stmt.bindLong(_argIndex, _item_1);
+ _argIndex++;
+ }
+ }
+ _argIndex = 1 + _inputSize + _inputSize_1;
+ if (ids3 == null) {
+ _stmt.bindNull(_argIndex);
+ } else {
+ for (int _item_2 : ids3) {
+ _stmt.bindLong(_argIndex, _item_2);
+ _argIndex++;
+ }
+ }
+ final List<Integer> _result = new ArrayList<Integer>();
+ while (_stmt.step()) {
+ final Integer _item_3;
+ if (_stmt.isNull(0)) {
+ _item_3 = null;
+ } else {
+ _item_3 = (int) (_stmt.getLong(0));
+ }
+ _result.add(_item_3);
+ }
+ return _result;
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
+
+ @Override
+ public LiveData<User> getByIdLive(final int id) {
+ final String _sql = "SELECT * FROM user where uid = ?";
+ final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 1);
+ int _argIndex = 1;
+ _statement.bindLong(_argIndex, id);
+ return __db.getInvalidationTracker().createLiveData(new String[] {"user"}, false, new Callable<User>() {
+ @Override
+ @Nullable
+ public User call() throws Exception {
+ final Cursor _cursor = DBUtil.query(__db, _statement, false, null);
+ try {
+ final int _cursorIndexOfUid = CursorUtil.getColumnIndexOrThrow(_cursor, "uid");
+ final int _cursorIndexOfName = CursorUtil.getColumnIndexOrThrow(_cursor, "name");
+ final int _cursorIndexOfLastName = CursorUtil.getColumnIndexOrThrow(_cursor, "lastName");
+ final int _cursorIndexOfAge = CursorUtil.getColumnIndexOrThrow(_cursor, "ageColumn");
+ final User _result;
+ if (_cursor.moveToFirst()) {
+ _result = new User();
+ _result.uid = _cursor.getInt(_cursorIndexOfUid);
+ _result.name = _cursor.getString(_cursorIndexOfName);
+ final String _tmpLastName;
+ _tmpLastName = _cursor.getString(_cursorIndexOfLastName);
+ _result.setLastName(_tmpLastName);
+ _result.age = _cursor.getInt(_cursorIndexOfAge);
+ } else {
+ _result = null;
+ }
+ return _result;
+ } finally {
+ _cursor.close();
+ }
+ }
+
+ @Override
+ protected void finalize() {
+ _statement.release();
+ }
+ });
+ }
+
+ @Override
+ public LiveData<List<User>> loadUsersByIdsLive(final int... ids) {
+ final StringBuilder _stringBuilder = new StringBuilder();
+ _stringBuilder.append("SELECT * FROM user where uid IN (");
+ final int _inputSize = ids == null ? 1 : ids.length;
+ StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
+ _stringBuilder.append(")");
+ final String _sql = _stringBuilder.toString();
+ final int _argCount = 0 + _inputSize;
+ final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, _argCount);
+ int _argIndex = 1;
+ if (ids == null) {
+ _statement.bindNull(_argIndex);
+ } else {
+ for (int _item : ids) {
+ _statement.bindLong(_argIndex, _item);
+ _argIndex++;
+ }
}
-}
\ No newline at end of file
+ return __db.getInvalidationTracker().createLiveData(new String[] {"user"}, false, new Callable<List<User>>() {
+ @Override
+ @Nullable
+ public List<User> call() throws Exception {
+ final Cursor _cursor = DBUtil.query(__db, _statement, false, null);
+ try {
+ final int _cursorIndexOfUid = CursorUtil.getColumnIndexOrThrow(_cursor, "uid");
+ final int _cursorIndexOfName = CursorUtil.getColumnIndexOrThrow(_cursor, "name");
+ final int _cursorIndexOfLastName = CursorUtil.getColumnIndexOrThrow(_cursor, "lastName");
+ final int _cursorIndexOfAge = CursorUtil.getColumnIndexOrThrow(_cursor, "ageColumn");
+ final List<User> _result = new ArrayList<User>();
+ while (_cursor.moveToNext()) {
+ final User _item_1;
+ _item_1 = new User();
+ _item_1.uid = _cursor.getInt(_cursorIndexOfUid);
+ _item_1.name = _cursor.getString(_cursorIndexOfName);
+ final String _tmpLastName;
+ _tmpLastName = _cursor.getString(_cursorIndexOfLastName);
+ _item_1.setLastName(_tmpLastName);
+ _item_1.age = _cursor.getInt(_cursorIndexOfAge);
+ _result.add(_item_1);
+ }
+ return _result;
+ } finally {
+ _cursor.close();
+ }
+ }
+
+ @Override
+ protected void finalize() {
+ _statement.release();
+ }
+ });
+ }
+
+ @Override
+ public List<Child1> getChild1List() {
+ final String _sql = "SELECT * FROM Child1";
+ return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<Child1>>() {
+ @Override
+ @NonNull
+ public List<Child1> invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ final int _cursorIndexOfId = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "id");
+ final int _cursorIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name");
+ final int _cursorIndexOfSerial = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "serial");
+ final int _cursorIndexOfCode = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "code");
+ final List<Child1> _result = new ArrayList<Child1>();
+ while (_stmt.step()) {
+ final Child1 _item;
+ final int _tmpId;
+ _tmpId = (int) (_stmt.getLong(_cursorIndexOfId));
+ final String _tmpName;
+ _tmpName = _stmt.getText(_cursorIndexOfName);
+ final Info _tmpInfo;
+ if (!(_stmt.isNull(_cursorIndexOfSerial) && _stmt.isNull(_cursorIndexOfCode))) {
+ _tmpInfo = new Info();
+ _tmpInfo.serial = (int) (_stmt.getLong(_cursorIndexOfSerial));
+ _tmpInfo.code = _stmt.getText(_cursorIndexOfCode);
+ } else {
+ _tmpInfo = null;
+ }
+ _item = new Child1(_tmpId,_tmpName,_tmpInfo);
+ _result.add(_item);
+ }
+ return _result;
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
+
+ @Override
+ public List<Child2> getChild2List() {
+ final String _sql = "SELECT * FROM Child2";
+ return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<Child2>>() {
+ @Override
+ @NonNull
+ public List<Child2> invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ final int _cursorIndexOfId = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "id");
+ final int _cursorIndexOfName = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "name");
+ final int _cursorIndexOfSerial = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "serial");
+ final int _cursorIndexOfCode = SQLiteStatementUtil.getColumnIndexOrThrow(_stmt, "code");
+ final List<Child2> _result = new ArrayList<Child2>();
+ while (_stmt.step()) {
+ final Child2 _item;
+ final int _tmpId;
+ _tmpId = (int) (_stmt.getLong(_cursorIndexOfId));
+ final String _tmpName;
+ _tmpName = _stmt.getText(_cursorIndexOfName);
+ final Info _tmpInfo;
+ if (!(_stmt.isNull(_cursorIndexOfSerial) && _stmt.isNull(_cursorIndexOfCode))) {
+ _tmpInfo = new Info();
+ _tmpInfo.serial = (int) (_stmt.getLong(_cursorIndexOfSerial));
+ _tmpInfo.code = _stmt.getText(_cursorIndexOfCode);
+ } else {
+ _tmpInfo = null;
+ }
+ _item = new Child2(_tmpId,_tmpName,_tmpInfo);
+ _result.add(_item);
+ }
+ return _result;
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
+
+ @Override
+ public ListenableFuture<List<Child1>> getChild1ListListenableFuture() {
+ final String _sql = "SELECT * FROM Child1";
+ final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 0);
+ final CancellationSignal _cancellationSignal = new CancellationSignal();
+ return GuavaRoom.createListenableFuture(__db, false, new Callable<List<Child1>>() {
+ @Override
+ public List<Child1> call() throws Exception {
+ final Cursor _cursor = DBUtil.query(__db, _statement, false, _cancellationSignal);
+ try {
+ final int _cursorIndexOfId = CursorUtil.getColumnIndexOrThrow(_cursor, "id");
+ final int _cursorIndexOfName = CursorUtil.getColumnIndexOrThrow(_cursor, "name");
+ final int _cursorIndexOfSerial = CursorUtil.getColumnIndexOrThrow(_cursor, "serial");
+ final int _cursorIndexOfCode = CursorUtil.getColumnIndexOrThrow(_cursor, "code");
+ final List<Child1> _result = new ArrayList<Child1>();
+ while (_cursor.moveToNext()) {
+ final Child1 _item;
+ final int _tmpId;
+ _tmpId = _cursor.getInt(_cursorIndexOfId);
+ final String _tmpName;
+ _tmpName = _cursor.getString(_cursorIndexOfName);
+ final Info _tmpInfo;
+ if (!(_cursor.isNull(_cursorIndexOfSerial) && _cursor.isNull(_cursorIndexOfCode))) {
+ _tmpInfo = new Info();
+ _tmpInfo.serial = _cursor.getInt(_cursorIndexOfSerial);
+ _tmpInfo.code = _cursor.getString(_cursorIndexOfCode);
+ } else {
+ _tmpInfo = null;
+ }
+ _item = new Child1(_tmpId,_tmpName,_tmpInfo);
+ _result.add(_item);
+ }
+ return _result;
+ } finally {
+ _cursor.close();
+ }
+ }
+ }, _statement, true, _cancellationSignal);
+ }
+
+ @Override
+ public List<UserSummary> getUserNames() {
+ final String _sql = "SELECT `uid`, `name` FROM (SELECT * FROM User)";
+ return DBUtil.performBlocking(__db, true, false, new Function1<SQLiteConnection, List<UserSummary>>() {
+ @Override
+ @NonNull
+ public List<UserSummary> invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ final int _cursorIndexOfUid = 0;
+ final int _cursorIndexOfName = 1;
+ final List<UserSummary> _result = new ArrayList<UserSummary>();
+ while (_stmt.step()) {
+ final UserSummary _item;
+ _item = new UserSummary();
+ _item.uid = (int) (_stmt.getLong(_cursorIndexOfUid));
+ _item.name = _stmt.getText(_cursorIndexOfName);
+ _result.add(_item);
+ }
+ return _result;
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
+
+ @Override
+ public User getUserViaRawQuery(final SupportSQLiteQuery rawQuery) {
+ __db.assertNotSuspendingTransaction();
+ final Cursor _cursor = DBUtil.query(__db, rawQuery, false, null);
+ try {
+ final User _result;
+ if (_cursor.moveToFirst()) {
+ _result = __entityCursorConverter_fooBarUser(_cursor);
+ } else {
+ _result = null;
+ }
+ return _result;
+ } finally {
+ _cursor.close();
+ }
+ }
+
+ @NonNull
+ public static List<Class<?>> getRequiredConverters() {
+ return Collections.emptyList();
+ }
+
+ private User __entityCursorConverter_fooBarUser(@NonNull final Cursor cursor) {
+ final User _entity;
+ final int _cursorIndexOfUid = CursorUtil.getColumnIndex(cursor, "uid");
+ final int _cursorIndexOfName = CursorUtil.getColumnIndex(cursor, "name");
+ final int _cursorIndexOfLastName = CursorUtil.getColumnIndex(cursor, "lastName");
+ final int _cursorIndexOfAge = CursorUtil.getColumnIndex(cursor, "ageColumn");
+ _entity = new User();
+ if (_cursorIndexOfUid != -1) {
+ _entity.uid = cursor.getInt(_cursorIndexOfUid);
+ }
+ if (_cursorIndexOfName != -1) {
+ _entity.name = cursor.getString(_cursorIndexOfName);
+ }
+ if (_cursorIndexOfLastName != -1) {
+ final String _tmpLastName;
+ _tmpLastName = cursor.getString(_cursorIndexOfLastName);
+ _entity.setLastName(_tmpLastName);
+ }
+ if (_cursorIndexOfAge != -1) {
+ _entity.age = cursor.getInt(_cursorIndexOfAge);
+ }
+ return _entity;
+ }
+}
diff --git a/room/room-compiler/src/test/test-data/daoWriter/output/ksp/DeletionDao.java b/room/room-compiler/src/test/test-data/daoWriter/output/ksp/DeletionDao.java
index 6228fe0..30b9808 100644
--- a/room/room-compiler/src/test/test-data/daoWriter/output/ksp/DeletionDao.java
+++ b/room/room-compiler/src/test/test-data/daoWriter/output/ksp/DeletionDao.java
@@ -31,381 +31,381 @@
@Generated("androidx.room.RoomProcessor")
@SuppressWarnings({"unchecked", "deprecation", "removal"})
public final class DeletionDao_Impl implements DeletionDao {
- private final RoomDatabase __db;
+ private final RoomDatabase __db;
- private final EntityDeleteOrUpdateAdapter<User> __deleteAdapterOfUser;
+ private final EntityDeleteOrUpdateAdapter<User> __deleteAdapterOfUser;
- private final EntityDeletionOrUpdateAdapter<User> __deleteCompatAdapterOfUser;
+ private final EntityDeletionOrUpdateAdapter<User> __deleteCompatAdapterOfUser;
- private final EntityDeleteOrUpdateAdapter<MultiPKeyEntity> __deleteAdapterOfMultiPKeyEntity;
+ private final EntityDeleteOrUpdateAdapter<MultiPKeyEntity> __deleteAdapterOfMultiPKeyEntity;
- private final EntityDeleteOrUpdateAdapter<Book> __deleteAdapterOfBook;
+ private final EntityDeleteOrUpdateAdapter<Book> __deleteAdapterOfBook;
- public DeletionDao_Impl(@NonNull final RoomDatabase __db) {
- this.__db = __db;
- this.__deleteAdapterOfUser = new EntityDeleteOrUpdateAdapter<User>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "DELETE FROM `User` WHERE `uid` = ?";
- }
+ public DeletionDao_Impl(@NonNull final RoomDatabase __db) {
+ this.__db = __db;
+ this.__deleteAdapterOfUser = new EntityDeleteOrUpdateAdapter<User>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "DELETE FROM `User` WHERE `uid` = ?";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, @NonNull final User entity) {
- statement.bindLong(1, entity.uid);
- }
- };
- this.__deleteCompatAdapterOfUser = new EntityDeletionOrUpdateAdapter<User>(__db) {
- @Override
- @NonNull
- protected String createQuery() {
- return "DELETE FROM `User` WHERE `uid` = ?";
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, @NonNull final User entity) {
+ statement.bindLong(1, entity.uid);
+ }
+ };
+ this.__deleteCompatAdapterOfUser = new EntityDeletionOrUpdateAdapter<User>(__db) {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "DELETE FROM `User` WHERE `uid` = ?";
+ }
- @Override
- protected void bind(@NonNull final SupportSQLiteStatement statement,
- @NonNull final User entity) {
- statement.bindLong(1, entity.uid);
- }
- };
- this.__deleteAdapterOfMultiPKeyEntity = new EntityDeleteOrUpdateAdapter<MultiPKeyEntity>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "DELETE FROM `MultiPKeyEntity` WHERE `name` = ? AND `lastName` = ?";
- }
+ @Override
+ protected void bind(@NonNull final SupportSQLiteStatement statement,
+ @NonNull final User entity) {
+ statement.bindLong(1, entity.uid);
+ }
+ };
+ this.__deleteAdapterOfMultiPKeyEntity = new EntityDeleteOrUpdateAdapter<MultiPKeyEntity>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "DELETE FROM `MultiPKeyEntity` WHERE `name` = ? AND `lastName` = ?";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement,
- @NonNull final MultiPKeyEntity entity) {
- statement.bindText(1, entity.name);
- statement.bindText(2, entity.lastName);
- }
- };
- this.__deleteAdapterOfBook = new EntityDeleteOrUpdateAdapter<Book>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "DELETE FROM `Book` WHERE `bookId` = ?";
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement,
+ @NonNull final MultiPKeyEntity entity) {
+ statement.bindText(1, entity.name);
+ statement.bindText(2, entity.lastName);
+ }
+ };
+ this.__deleteAdapterOfBook = new EntityDeleteOrUpdateAdapter<Book>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "DELETE FROM `Book` WHERE `bookId` = ?";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, @NonNull final Book entity) {
- statement.bindLong(1, entity.bookId);
- }
- };
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, @NonNull final Book entity) {
+ statement.bindLong(1, entity.bookId);
+ }
+ };
+ }
- @Override
- public void deleteUser(final User user) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __deleteAdapterOfUser.handle(_connection, user);
- return null;
- }
- });
- }
+ @Override
+ public void deleteUser(final User user) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __deleteAdapterOfUser.handle(_connection, user);
+ return null;
+ }
+ });
+ }
- @Override
- public void deleteUsers(final User user1, final List<User> others) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __deleteAdapterOfUser.handle(_connection, user1);
- __deleteAdapterOfUser.handleMultiple(_connection, others);
- return null;
- }
- });
- }
+ @Override
+ public void deleteUsers(final User user1, final List<User> others) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __deleteAdapterOfUser.handle(_connection, user1);
+ __deleteAdapterOfUser.handleMultiple(_connection, others);
+ return null;
+ }
+ });
+ }
- @Override
- public void deleteArrayOfUsers(final User[] users) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __deleteAdapterOfUser.handleMultiple(_connection, users);
- return null;
- }
- });
- }
+ @Override
+ public void deleteArrayOfUsers(final User[] users) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __deleteAdapterOfUser.handleMultiple(_connection, users);
+ return null;
+ }
+ });
+ }
- @Override
- public Integer deleteUserAndReturnCountObject(final User user) {
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- int _result = 0;
- _result += __deleteAdapterOfUser.handle(_connection, user);
- return _result;
- }
- });
- }
+ @Override
+ public Integer deleteUserAndReturnCountObject(final User user) {
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ int _result = 0;
+ _result += __deleteAdapterOfUser.handle(_connection, user);
+ return _result;
+ }
+ });
+ }
- @Override
- public int deleteUserAndReturnCount(final User user) {
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- int _result = 0;
- _result += __deleteAdapterOfUser.handle(_connection, user);
- return _result;
- }
- });
- }
+ @Override
+ public int deleteUserAndReturnCount(final User user) {
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ int _result = 0;
+ _result += __deleteAdapterOfUser.handle(_connection, user);
+ return _result;
+ }
+ });
+ }
- @Override
- public int deleteUserAndReturnCount(final User user1, final List<User> others) {
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- int _result = 0;
- _result += __deleteAdapterOfUser.handle(_connection, user1);
- _result += __deleteAdapterOfUser.handleMultiple(_connection, others);
- return _result;
- }
- });
- }
+ @Override
+ public int deleteUserAndReturnCount(final User user1, final List<User> others) {
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ int _result = 0;
+ _result += __deleteAdapterOfUser.handle(_connection, user1);
+ _result += __deleteAdapterOfUser.handleMultiple(_connection, others);
+ return _result;
+ }
+ });
+ }
- @Override
- public int deleteUserAndReturnCount(final User[] users) {
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- int _result = 0;
- _result += __deleteAdapterOfUser.handleMultiple(_connection, users);
- return _result;
- }
- });
- }
+ @Override
+ public int deleteUserAndReturnCount(final User[] users) {
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ int _result = 0;
+ _result += __deleteAdapterOfUser.handleMultiple(_connection, users);
+ return _result;
+ }
+ });
+ }
- @Override
- public Completable deleteUserCompletable(final User user) {
- return Completable.fromCallable(new Callable<Void>() {
- @Override
- @Nullable
- public Void call() throws Exception {
- __db.beginTransaction();
- try {
- __deleteCompatAdapterOfUser.handle(user);
- __db.setTransactionSuccessful();
- return null;
- } finally {
- __db.endTransaction();
- }
- }
- });
- }
+ @Override
+ public Completable deleteUserCompletable(final User user) {
+ return Completable.fromCallable(new Callable<Void>() {
+ @Override
+ @Nullable
+ public Void call() throws Exception {
+ __db.beginTransaction();
+ try {
+ __deleteCompatAdapterOfUser.handle(user);
+ __db.setTransactionSuccessful();
+ return null;
+ } finally {
+ __db.endTransaction();
+ }
+ }
+ });
+ }
- @Override
- public Single<Integer> deleteUserSingle(final User user) {
- return Single.fromCallable(new Callable<Integer>() {
- @Override
- @Nullable
- public Integer call() throws Exception {
- int _total = 0;
- __db.beginTransaction();
- try {
- _total += __deleteCompatAdapterOfUser.handle(user);
- __db.setTransactionSuccessful();
- return _total;
- } finally {
- __db.endTransaction();
- }
- }
- });
- }
+ @Override
+ public Single<Integer> deleteUserSingle(final User user) {
+ return Single.fromCallable(new Callable<Integer>() {
+ @Override
+ @Nullable
+ public Integer call() throws Exception {
+ int _total = 0;
+ __db.beginTransaction();
+ try {
+ _total += __deleteCompatAdapterOfUser.handle(user);
+ __db.setTransactionSuccessful();
+ return _total;
+ } finally {
+ __db.endTransaction();
+ }
+ }
+ });
+ }
- @Override
- public Maybe<Integer> deleteUserMaybe(final User user) {
- return Maybe.fromCallable(new Callable<Integer>() {
- @Override
- @Nullable
- public Integer call() throws Exception {
- int _total = 0;
- __db.beginTransaction();
- try {
- _total += __deleteCompatAdapterOfUser.handle(user);
- __db.setTransactionSuccessful();
- return _total;
- } finally {
- __db.endTransaction();
- }
- }
- });
- }
+ @Override
+ public Maybe<Integer> deleteUserMaybe(final User user) {
+ return Maybe.fromCallable(new Callable<Integer>() {
+ @Override
+ @Nullable
+ public Integer call() throws Exception {
+ int _total = 0;
+ __db.beginTransaction();
+ try {
+ _total += __deleteCompatAdapterOfUser.handle(user);
+ __db.setTransactionSuccessful();
+ return _total;
+ } finally {
+ __db.endTransaction();
+ }
+ }
+ });
+ }
- @Override
- public int multiPKey(final MultiPKeyEntity entity) {
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- int _result = 0;
- _result += __deleteAdapterOfMultiPKeyEntity.handle(_connection, entity);
- return _result;
- }
- });
- }
+ @Override
+ public int multiPKey(final MultiPKeyEntity entity) {
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ int _result = 0;
+ _result += __deleteAdapterOfMultiPKeyEntity.handle(_connection, entity);
+ return _result;
+ }
+ });
+ }
- @Override
- public void deleteUserAndBook(final User user, final Book book) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __deleteAdapterOfUser.handle(_connection, user);
- __deleteAdapterOfBook.handle(_connection, book);
- return null;
- }
- });
- }
+ @Override
+ public void deleteUserAndBook(final User user, final Book book) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __deleteAdapterOfUser.handle(_connection, user);
+ __deleteAdapterOfBook.handle(_connection, book);
+ return null;
+ }
+ });
+ }
- @Override
- public int deleteByUid(final int uid) {
+ @Override
+ public int deleteByUid(final int uid) {
+ final String _sql = "DELETE FROM user where uid = ?";
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ int _argIndex = 1;
+ _stmt.bindLong(_argIndex, uid);
+ _stmt.step();
+ return SQLiteConnectionUtil.getTotalChangedRows(_connection);
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
+
+ @Override
+ public Completable deleteByUidCompletable(final int uid) {
+ return Completable.fromCallable(new Callable<Void>() {
+ @Override
+ @Nullable
+ public Void call() throws Exception {
final String _sql = "DELETE FROM user where uid = ?";
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- int _argIndex = 1;
- _stmt.bindLong(_argIndex, uid);
- _stmt.step();
- return SQLiteConnectionUtil.getTotalChangedRows(_connection);
- } finally {
- _stmt.close();
- }
- }
- });
- }
+ final SupportSQLiteStatement _stmt = __db.compileStatement(_sql);
+ int _argIndex = 1;
+ _stmt.bindLong(_argIndex, uid);
+ __db.beginTransaction();
+ try {
+ _stmt.executeUpdateDelete();
+ __db.setTransactionSuccessful();
+ return null;
+ } finally {
+ __db.endTransaction();
+ }
+ }
+ });
+ }
- @Override
- public Completable deleteByUidCompletable(final int uid) {
- return Completable.fromCallable(new Callable<Void>() {
- @Override
- @Nullable
- public Void call() throws Exception {
- final String _sql = "DELETE FROM user where uid = ?";
- final SupportSQLiteStatement _stmt = __db.compileStatement(_sql);
- int _argIndex = 1;
- _stmt.bindLong(_argIndex, uid);
- __db.beginTransaction();
- try {
- _stmt.executeUpdateDelete();
- __db.setTransactionSuccessful();
- return null;
- } finally {
- __db.endTransaction();
- }
- }
- });
- }
+ @Override
+ public Single<Integer> deleteByUidSingle(final int uid) {
+ return Single.fromCallable(new Callable<Integer>() {
+ @Override
+ @Nullable
+ public Integer call() throws Exception {
+ final String _sql = "DELETE FROM user where uid = ?";
+ final SupportSQLiteStatement _stmt = __db.compileStatement(_sql);
+ int _argIndex = 1;
+ _stmt.bindLong(_argIndex, uid);
+ __db.beginTransaction();
+ try {
+ final Integer _result = _stmt.executeUpdateDelete();
+ __db.setTransactionSuccessful();
+ return _result;
+ } finally {
+ __db.endTransaction();
+ }
+ }
+ });
+ }
- @Override
- public Single<Integer> deleteByUidSingle(final int uid) {
- return Single.fromCallable(new Callable<Integer>() {
- @Override
- @Nullable
- public Integer call() throws Exception {
- final String _sql = "DELETE FROM user where uid = ?";
- final SupportSQLiteStatement _stmt = __db.compileStatement(_sql);
- int _argIndex = 1;
- _stmt.bindLong(_argIndex, uid);
- __db.beginTransaction();
- try {
- final Integer _result = _stmt.executeUpdateDelete();
- __db.setTransactionSuccessful();
- return _result;
- } finally {
- __db.endTransaction();
- }
- }
- });
- }
+ @Override
+ public Maybe<Integer> deleteByUidMaybe(final int uid) {
+ return Maybe.fromCallable(new Callable<Integer>() {
+ @Override
+ @Nullable
+ public Integer call() throws Exception {
+ final String _sql = "DELETE FROM user where uid = ?";
+ final SupportSQLiteStatement _stmt = __db.compileStatement(_sql);
+ int _argIndex = 1;
+ _stmt.bindLong(_argIndex, uid);
+ __db.beginTransaction();
+ try {
+ final Integer _result = _stmt.executeUpdateDelete();
+ __db.setTransactionSuccessful();
+ return _result;
+ } finally {
+ __db.endTransaction();
+ }
+ }
+ });
+ }
- @Override
- public Maybe<Integer> deleteByUidMaybe(final int uid) {
- return Maybe.fromCallable(new Callable<Integer>() {
- @Override
- @Nullable
- public Integer call() throws Exception {
- final String _sql = "DELETE FROM user where uid = ?";
- final SupportSQLiteStatement _stmt = __db.compileStatement(_sql);
- int _argIndex = 1;
- _stmt.bindLong(_argIndex, uid);
- __db.beginTransaction();
- try {
- final Integer _result = _stmt.executeUpdateDelete();
- __db.setTransactionSuccessful();
- return _result;
- } finally {
- __db.endTransaction();
- }
+ @Override
+ public int deleteByUidList(final int... uid) {
+ final StringBuilder _stringBuilder = new StringBuilder();
+ _stringBuilder.append("DELETE FROM user where uid IN(");
+ final int _inputSize = uid == null ? 1 : uid.length;
+ StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
+ _stringBuilder.append(")");
+ final String _sql = _stringBuilder.toString();
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ int _argIndex = 1;
+ if (uid == null) {
+ _stmt.bindNull(_argIndex);
+ } else {
+ for (int _item : uid) {
+ _stmt.bindLong(_argIndex, _item);
+ _argIndex++;
}
- });
- }
+ }
+ _stmt.step();
+ return SQLiteConnectionUtil.getTotalChangedRows(_connection);
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
- @Override
- public int deleteByUidList(final int... uid) {
- final StringBuilder _stringBuilder = new StringBuilder();
- _stringBuilder.append("DELETE FROM user where uid IN(");
- final int _inputSize = uid == null ? 1 : uid.length;
- StringUtil.appendPlaceholders(_stringBuilder, _inputSize);
- _stringBuilder.append(")");
- final String _sql = _stringBuilder.toString();
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- int _argIndex = 1;
- if (uid == null) {
- _stmt.bindNull(_argIndex);
- } else {
- for (int _item : uid) {
- _stmt.bindLong(_argIndex, _item);
- _argIndex++;
- }
- }
- _stmt.step();
- return SQLiteConnectionUtil.getTotalChangedRows(_connection);
- } finally {
- _stmt.close();
- }
- }
- });
- }
+ @Override
+ public int deleteEverything() {
+ final String _sql = "DELETE FROM user";
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ _stmt.step();
+ return SQLiteConnectionUtil.getTotalChangedRows(_connection);
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
- @Override
- public int deleteEverything() {
- final String _sql = "DELETE FROM user";
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- _stmt.step();
- return SQLiteConnectionUtil.getTotalChangedRows(_connection);
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @NonNull
- public static List<Class<?>> getRequiredConverters() {
- return Collections.emptyList();
- }
-}
\ No newline at end of file
+ @NonNull
+ public static List<Class<?>> getRequiredConverters() {
+ return Collections.emptyList();
+ }
+}
diff --git a/room/room-compiler/src/test/test-data/daoWriter/output/ksp/UpdateDao.java b/room/room-compiler/src/test/test-data/daoWriter/output/ksp/UpdateDao.java
index afbf5da..484b1e8 100644
--- a/room/room-compiler/src/test/test-data/daoWriter/output/ksp/UpdateDao.java
+++ b/room/room-compiler/src/test/test-data/daoWriter/output/ksp/UpdateDao.java
@@ -29,394 +29,394 @@
@Generated("androidx.room.RoomProcessor")
@SuppressWarnings({"unchecked", "deprecation", "removal"})
public final class UpdateDao_Impl implements UpdateDao {
- private final RoomDatabase __db;
+ private final RoomDatabase __db;
- private final EntityDeleteOrUpdateAdapter<User> __updateAdapterOfUser;
+ private final EntityDeleteOrUpdateAdapter<User> __updateAdapterOfUser;
- private final EntityDeleteOrUpdateAdapter<User> __updateAdapterOfUser_1;
+ private final EntityDeleteOrUpdateAdapter<User> __updateAdapterOfUser_1;
- private final EntityDeletionOrUpdateAdapter<User> __updateCompatAdapterOfUser;
+ private final EntityDeletionOrUpdateAdapter<User> __updateCompatAdapterOfUser;
- private final EntityDeleteOrUpdateAdapter<MultiPKeyEntity> __updateAdapterOfMultiPKeyEntity;
+ private final EntityDeleteOrUpdateAdapter<MultiPKeyEntity> __updateAdapterOfMultiPKeyEntity;
- private final EntityDeleteOrUpdateAdapter<Book> __updateAdapterOfBook;
+ private final EntityDeleteOrUpdateAdapter<Book> __updateAdapterOfBook;
- public UpdateDao_Impl(@NonNull final RoomDatabase __db) {
- this.__db = __db;
- this.__updateAdapterOfUser = new EntityDeleteOrUpdateAdapter<User>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "UPDATE OR ABORT `User` SET `uid` = ?,`name` = ?,`lastName` = ?,`ageColumn` = ? WHERE `uid` = ?";
- }
+ public UpdateDao_Impl(@NonNull final RoomDatabase __db) {
+ this.__db = __db;
+ this.__updateAdapterOfUser = new EntityDeleteOrUpdateAdapter<User>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "UPDATE OR ABORT `User` SET `uid` = ?,`name` = ?,`lastName` = ?,`ageColumn` = ? WHERE `uid` = ?";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, @NonNull final User entity) {
- statement.bindLong(1, entity.uid);
- statement.bindText(2, entity.name);
- statement.bindText(3, entity.getLastName());
- statement.bindLong(4, entity.age);
- statement.bindLong(5, entity.uid);
- }
- };
- this.__updateAdapterOfUser_1 = new EntityDeleteOrUpdateAdapter<User>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "UPDATE `User` SET `uid` = ?,`name` = ?,`lastName` = ?,`ageColumn` = ? WHERE `uid` = ?";
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, @NonNull final User entity) {
+ statement.bindLong(1, entity.uid);
+ statement.bindText(2, entity.name);
+ statement.bindText(3, entity.getLastName());
+ statement.bindLong(4, entity.age);
+ statement.bindLong(5, entity.uid);
+ }
+ };
+ this.__updateAdapterOfUser_1 = new EntityDeleteOrUpdateAdapter<User>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "UPDATE `User` SET `uid` = ?,`name` = ?,`lastName` = ?,`ageColumn` = ? WHERE `uid` = ?";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, @NonNull final User entity) {
- statement.bindLong(1, entity.uid);
- statement.bindText(2, entity.name);
- statement.bindText(3, entity.getLastName());
- statement.bindLong(4, entity.age);
- statement.bindLong(5, entity.uid);
- }
- };
- this.__updateCompatAdapterOfUser = new EntityDeletionOrUpdateAdapter<User>(__db) {
- @Override
- @NonNull
- protected String createQuery() {
- return "UPDATE OR ABORT `User` SET `uid` = ?,`name` = ?,`lastName` = ?,`ageColumn` = ? WHERE `uid` = ?";
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, @NonNull final User entity) {
+ statement.bindLong(1, entity.uid);
+ statement.bindText(2, entity.name);
+ statement.bindText(3, entity.getLastName());
+ statement.bindLong(4, entity.age);
+ statement.bindLong(5, entity.uid);
+ }
+ };
+ this.__updateCompatAdapterOfUser = new EntityDeletionOrUpdateAdapter<User>(__db) {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "UPDATE OR ABORT `User` SET `uid` = ?,`name` = ?,`lastName` = ?,`ageColumn` = ? WHERE `uid` = ?";
+ }
- @Override
- protected void bind(@NonNull final SupportSQLiteStatement statement,
- @NonNull final User entity) {
- statement.bindLong(1, entity.uid);
- statement.bindString(2, entity.name);
- statement.bindString(3, entity.getLastName());
- statement.bindLong(4, entity.age);
- statement.bindLong(5, entity.uid);
- }
- };
- this.__updateAdapterOfMultiPKeyEntity = new EntityDeleteOrUpdateAdapter<MultiPKeyEntity>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "UPDATE OR ABORT `MultiPKeyEntity` SET `name` = ?,`lastName` = ? WHERE `name` = ? AND `lastName` = ?";
- }
+ @Override
+ protected void bind(@NonNull final SupportSQLiteStatement statement,
+ @NonNull final User entity) {
+ statement.bindLong(1, entity.uid);
+ statement.bindString(2, entity.name);
+ statement.bindString(3, entity.getLastName());
+ statement.bindLong(4, entity.age);
+ statement.bindLong(5, entity.uid);
+ }
+ };
+ this.__updateAdapterOfMultiPKeyEntity = new EntityDeleteOrUpdateAdapter<MultiPKeyEntity>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "UPDATE OR ABORT `MultiPKeyEntity` SET `name` = ?,`lastName` = ? WHERE `name` = ? AND `lastName` = ?";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement,
- @NonNull final MultiPKeyEntity entity) {
- statement.bindText(1, entity.name);
- statement.bindText(2, entity.lastName);
- statement.bindText(3, entity.name);
- statement.bindText(4, entity.lastName);
- }
- };
- this.__updateAdapterOfBook = new EntityDeleteOrUpdateAdapter<Book>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "UPDATE OR ABORT `Book` SET `bookId` = ?,`uid` = ? WHERE `bookId` = ?";
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement,
+ @NonNull final MultiPKeyEntity entity) {
+ statement.bindText(1, entity.name);
+ statement.bindText(2, entity.lastName);
+ statement.bindText(3, entity.name);
+ statement.bindText(4, entity.lastName);
+ }
+ };
+ this.__updateAdapterOfBook = new EntityDeleteOrUpdateAdapter<Book>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "UPDATE OR ABORT `Book` SET `bookId` = ?,`uid` = ? WHERE `bookId` = ?";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, @NonNull final Book entity) {
- statement.bindLong(1, entity.bookId);
- statement.bindLong(2, entity.uid);
- statement.bindLong(3, entity.bookId);
- }
- };
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, @NonNull final Book entity) {
+ statement.bindLong(1, entity.bookId);
+ statement.bindLong(2, entity.uid);
+ statement.bindLong(3, entity.bookId);
+ }
+ };
+ }
- @Override
- public void updateUser(final User user) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __updateAdapterOfUser.handle(_connection, user);
- return null;
- }
+ @Override
+ public void updateUser(final User user) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __updateAdapterOfUser.handle(_connection, user);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public void updateUsers(final User user1, final List<User> others) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __updateAdapterOfUser.handle(_connection, user1);
+ __updateAdapterOfUser.handleMultiple(_connection, others);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public void updateArrayOfUsers(final User[] users) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __updateAdapterOfUser.handleMultiple(_connection, users);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public void updateTwoUsers(final User userOne, final User userTwo) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __updateAdapterOfUser_1.handle(_connection, userOne);
+ __updateAdapterOfUser_1.handle(_connection, userTwo);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public int updateUserAndReturnCount(final User user) {
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ int _result = 0;
+ _result += __updateAdapterOfUser.handle(_connection, user);
+ return _result;
+ }
+ });
+ }
+
+ @Override
+ public int updateUserAndReturnCount(final User user1, final List<User> others) {
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ int _result = 0;
+ _result += __updateAdapterOfUser.handle(_connection, user1);
+ _result += __updateAdapterOfUser.handleMultiple(_connection, others);
+ return _result;
+ }
+ });
+ }
+
+ @Override
+ public int updateUserAndReturnCount(final User[] users) {
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ int _result = 0;
+ _result += __updateAdapterOfUser.handleMultiple(_connection, users);
+ return _result;
+ }
+ });
+ }
+
+ @Override
+ public Integer updateUserAndReturnCountObject(final User user) {
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ int _result = 0;
+ _result += __updateAdapterOfUser.handle(_connection, user);
+ return _result;
+ }
+ });
+ }
+
+ @Override
+ public Completable updateUserAndReturnCountCompletable(final User user) {
+ return Completable.fromCallable(new Callable<Void>() {
+ @Override
+ @Nullable
+ public Void call() throws Exception {
+ __db.beginTransaction();
+ try {
+ __updateCompatAdapterOfUser.handle(user);
+ __db.setTransactionSuccessful();
+ return null;
+ } finally {
+ __db.endTransaction();
+ }
+ }
+ });
+ }
+
+ @Override
+ public Single<Integer> updateUserAndReturnCountSingle(final User user) {
+ return Single.fromCallable(new Callable<Integer>() {
+ @Override
+ @Nullable
+ public Integer call() throws Exception {
+ int _total = 0;
+ __db.beginTransaction();
+ try {
+ _total += __updateCompatAdapterOfUser.handle(user);
+ __db.setTransactionSuccessful();
+ return _total;
+ } finally {
+ __db.endTransaction();
+ }
+ }
+ });
+ }
+
+ @Override
+ public Maybe<Integer> updateUserAndReturnCountMaybe(final User user) {
+ return Maybe.fromCallable(new Callable<Integer>() {
+ @Override
+ @Nullable
+ public Integer call() throws Exception {
+ int _total = 0;
+ __db.beginTransaction();
+ try {
+ _total += __updateCompatAdapterOfUser.handle(user);
+ __db.setTransactionSuccessful();
+ return _total;
+ } finally {
+ __db.endTransaction();
+ }
+ }
+ });
+ }
+
+ @Override
+ public int multiPKey(final MultiPKeyEntity entity) {
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
+ @Override
+ @NonNull
+ public Integer invoke(@NonNull final SQLiteConnection _connection) {
+ int _result = 0;
+ _result += __updateAdapterOfMultiPKeyEntity.handle(_connection, entity);
+ return _result;
+ }
+ });
+ }
+
+ @Override
+ public void updateUserAndBook(final User user, final Book book) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __updateAdapterOfUser.handle(_connection, user);
+ __updateAdapterOfBook.handle(_connection, book);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public void updateAndAge(final User user) {
+ DBUtil.performBlocking(__db, false, true, (_connection) -> {
+ UpdateDao.super.updateAndAge(user);
+ return Unit.INSTANCE;
});
- }
+ }
- @Override
- public void updateUsers(final User user1, final List<User> others) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __updateAdapterOfUser.handle(_connection, user1);
- __updateAdapterOfUser.handleMultiple(_connection, others);
- return null;
- }
- });
- }
+ @Override
+ public void ageUserByUid(final String uid) {
+ final String _sql = "UPDATE User SET ageColumn = ageColumn + 1 WHERE uid = ?";
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ int _argIndex = 1;
+ _stmt.bindText(_argIndex, uid);
+ _stmt.step();
+ return null;
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
- @Override
- public void updateArrayOfUsers(final User[] users) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __updateAdapterOfUser.handleMultiple(_connection, users);
- return null;
- }
- });
- }
+ @Override
+ public void ageUserAll() {
+ final String _sql = "UPDATE User SET ageColumn = ageColumn + 1";
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ final SQLiteStatement _stmt = _connection.prepare(_sql);
+ try {
+ _stmt.step();
+ return null;
+ } finally {
+ _stmt.close();
+ }
+ }
+ });
+ }
- @Override
- public void updateTwoUsers(final User userOne, final User userTwo) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __updateAdapterOfUser_1.handle(_connection, userOne);
- __updateAdapterOfUser_1.handle(_connection, userTwo);
- return null;
- }
- });
- }
-
- @Override
- public int updateUserAndReturnCount(final User user) {
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- int _result = 0;
- _result += __updateAdapterOfUser.handle(_connection, user);
- return _result;
- }
- });
- }
-
- @Override
- public int updateUserAndReturnCount(final User user1, final List<User> others) {
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- int _result = 0;
- _result += __updateAdapterOfUser.handle(_connection, user1);
- _result += __updateAdapterOfUser.handleMultiple(_connection, others);
- return _result;
- }
- });
- }
-
- @Override
- public int updateUserAndReturnCount(final User[] users) {
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- int _result = 0;
- _result += __updateAdapterOfUser.handleMultiple(_connection, users);
- return _result;
- }
- });
- }
-
- @Override
- public Integer updateUserAndReturnCountObject(final User user) {
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- int _result = 0;
- _result += __updateAdapterOfUser.handle(_connection, user);
- return _result;
- }
- });
- }
-
- @Override
- public Completable updateUserAndReturnCountCompletable(final User user) {
- return Completable.fromCallable(new Callable<Void>() {
- @Override
- @Nullable
- public Void call() throws Exception {
- __db.beginTransaction();
- try {
- __updateCompatAdapterOfUser.handle(user);
- __db.setTransactionSuccessful();
- return null;
- } finally {
- __db.endTransaction();
- }
- }
- });
- }
-
- @Override
- public Single<Integer> updateUserAndReturnCountSingle(final User user) {
- return Single.fromCallable(new Callable<Integer>() {
- @Override
- @Nullable
- public Integer call() throws Exception {
- int _total = 0;
- __db.beginTransaction();
- try {
- _total += __updateCompatAdapterOfUser.handle(user);
- __db.setTransactionSuccessful();
- return _total;
- } finally {
- __db.endTransaction();
- }
- }
- });
- }
-
- @Override
- public Maybe<Integer> updateUserAndReturnCountMaybe(final User user) {
- return Maybe.fromCallable(new Callable<Integer>() {
- @Override
- @Nullable
- public Integer call() throws Exception {
- int _total = 0;
- __db.beginTransaction();
- try {
- _total += __updateCompatAdapterOfUser.handle(user);
- __db.setTransactionSuccessful();
- return _total;
- } finally {
- __db.endTransaction();
- }
- }
- });
- }
-
- @Override
- public int multiPKey(final MultiPKeyEntity entity) {
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
- @Override
- @NonNull
- public Integer invoke(@NonNull final SQLiteConnection _connection) {
- int _result = 0;
- _result += __updateAdapterOfMultiPKeyEntity.handle(_connection, entity);
- return _result;
- }
- });
- }
-
- @Override
- public void updateUserAndBook(final User user, final Book book) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __updateAdapterOfUser.handle(_connection, user);
- __updateAdapterOfBook.handle(_connection, book);
- return null;
- }
- });
- }
-
- @Override
- public void updateAndAge(final User user) {
- DBUtil.performBlocking(__db, false, true, (_connection) -> {
- UpdateDao.super.updateAndAge(user);
- return Unit.INSTANCE;
- });
- }
-
- @Override
- public void ageUserByUid(final String uid) {
- final String _sql = "UPDATE User SET ageColumn = ageColumn + 1 WHERE uid = ?";
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- int _argIndex = 1;
- _stmt.bindText(_argIndex, uid);
- _stmt.step();
- return null;
- } finally {
- _stmt.close();
- }
- }
- });
- }
-
- @Override
- public void ageUserAll() {
+ @Override
+ public Completable ageUserAllCompletable() {
+ return Completable.fromCallable(new Callable<Void>() {
+ @Override
+ @Nullable
+ public Void call() throws Exception {
final String _sql = "UPDATE User SET ageColumn = ageColumn + 1";
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- final SQLiteStatement _stmt = _connection.prepare(_sql);
- try {
- _stmt.step();
- return null;
- } finally {
- _stmt.close();
- }
- }
- });
- }
+ final SupportSQLiteStatement _stmt = __db.compileStatement(_sql);
+ __db.beginTransaction();
+ try {
+ _stmt.executeUpdateDelete();
+ __db.setTransactionSuccessful();
+ return null;
+ } finally {
+ __db.endTransaction();
+ }
+ }
+ });
+ }
- @Override
- public Completable ageUserAllCompletable() {
- return Completable.fromCallable(new Callable<Void>() {
- @Override
- @Nullable
- public Void call() throws Exception {
- final String _sql = "UPDATE User SET ageColumn = ageColumn + 1";
- final SupportSQLiteStatement _stmt = __db.compileStatement(_sql);
- __db.beginTransaction();
- try {
- _stmt.executeUpdateDelete();
- __db.setTransactionSuccessful();
- return null;
- } finally {
- __db.endTransaction();
- }
- }
- });
- }
+ @Override
+ public Single<Integer> ageUserAllSingle() {
+ return Single.fromCallable(new Callable<Integer>() {
+ @Override
+ @Nullable
+ public Integer call() throws Exception {
+ final String _sql = "UPDATE User SET ageColumn = ageColumn + 1";
+ final SupportSQLiteStatement _stmt = __db.compileStatement(_sql);
+ __db.beginTransaction();
+ try {
+ final Integer _result = _stmt.executeUpdateDelete();
+ __db.setTransactionSuccessful();
+ return _result;
+ } finally {
+ __db.endTransaction();
+ }
+ }
+ });
+ }
- @Override
- public Single<Integer> ageUserAllSingle() {
- return Single.fromCallable(new Callable<Integer>() {
- @Override
- @Nullable
- public Integer call() throws Exception {
- final String _sql = "UPDATE User SET ageColumn = ageColumn + 1";
- final SupportSQLiteStatement _stmt = __db.compileStatement(_sql);
- __db.beginTransaction();
- try {
- final Integer _result = _stmt.executeUpdateDelete();
- __db.setTransactionSuccessful();
- return _result;
- } finally {
- __db.endTransaction();
- }
- }
- });
- }
+ @Override
+ public Maybe<Integer> ageUserAllMaybe() {
+ return Maybe.fromCallable(new Callable<Integer>() {
+ @Override
+ @Nullable
+ public Integer call() throws Exception {
+ final String _sql = "UPDATE User SET ageColumn = ageColumn + 1";
+ final SupportSQLiteStatement _stmt = __db.compileStatement(_sql);
+ __db.beginTransaction();
+ try {
+ final Integer _result = _stmt.executeUpdateDelete();
+ __db.setTransactionSuccessful();
+ return _result;
+ } finally {
+ __db.endTransaction();
+ }
+ }
+ });
+ }
- @Override
- public Maybe<Integer> ageUserAllMaybe() {
- return Maybe.fromCallable(new Callable<Integer>() {
- @Override
- @Nullable
- public Integer call() throws Exception {
- final String _sql = "UPDATE User SET ageColumn = ageColumn + 1";
- final SupportSQLiteStatement _stmt = __db.compileStatement(_sql);
- __db.beginTransaction();
- try {
- final Integer _result = _stmt.executeUpdateDelete();
- __db.setTransactionSuccessful();
- return _result;
- } finally {
- __db.endTransaction();
- }
- }
- });
- }
-
- @NonNull
- public static List<Class<?>> getRequiredConverters() {
- return Collections.emptyList();
- }
-}
\ No newline at end of file
+ @NonNull
+ public static List<Class<?>> getRequiredConverters() {
+ return Collections.emptyList();
+ }
+}
diff --git a/room/room-compiler/src/test/test-data/daoWriter/output/ksp/UpsertDao.java b/room/room-compiler/src/test/test-data/daoWriter/output/ksp/UpsertDao.java
index 0858d17..7e6b603 100644
--- a/room/room-compiler/src/test/test-data/daoWriter/output/ksp/UpsertDao.java
+++ b/room/room-compiler/src/test/test-data/daoWriter/output/ksp/UpsertDao.java
@@ -22,159 +22,159 @@
@Generated("androidx.room.RoomProcessor")
@SuppressWarnings({"unchecked", "deprecation", "removal"})
public final class UpsertDao_Impl implements UpsertDao {
- private final RoomDatabase __db;
+ private final RoomDatabase __db;
- private final EntityUpsertAdapter<User> __upsertAdapterOfUser;
+ private final EntityUpsertAdapter<User> __upsertAdapterOfUser;
- private final EntityUpsertAdapter<Book> __upsertAdapterOfBook;
+ private final EntityUpsertAdapter<Book> __upsertAdapterOfBook;
- public UpsertDao_Impl(@NonNull final RoomDatabase __db) {
- this.__db = __db;
- this.__upsertAdapterOfUser = new EntityUpsertAdapter<User>(new EntityInsertAdapter<User>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "INSERT INTO `User` (`uid`,`name`,`lastName`,`ageColumn`) VALUES (?,?,?,?)";
- }
+ public UpsertDao_Impl(@NonNull final RoomDatabase __db) {
+ this.__db = __db;
+ this.__upsertAdapterOfUser = new EntityUpsertAdapter<User>(new EntityInsertAdapter<User>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "INSERT INTO `User` (`uid`,`name`,`lastName`,`ageColumn`) VALUES (?,?,?,?)";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, @NonNull final User entity) {
- statement.bindLong(1, entity.uid);
- statement.bindText(2, entity.name);
- statement.bindText(3, entity.getLastName());
- statement.bindLong(4, entity.age);
- }
- }, new EntityDeleteOrUpdateAdapter<User>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "UPDATE `User` SET `uid` = ?,`name` = ?,`lastName` = ?,`ageColumn` = ? WHERE `uid` = ?";
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, @NonNull final User entity) {
+ statement.bindLong(1, entity.uid);
+ statement.bindText(2, entity.name);
+ statement.bindText(3, entity.getLastName());
+ statement.bindLong(4, entity.age);
+ }
+ }, new EntityDeleteOrUpdateAdapter<User>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "UPDATE `User` SET `uid` = ?,`name` = ?,`lastName` = ?,`ageColumn` = ? WHERE `uid` = ?";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, @NonNull final User entity) {
- statement.bindLong(1, entity.uid);
- statement.bindText(2, entity.name);
- statement.bindText(3, entity.getLastName());
- statement.bindLong(4, entity.age);
- statement.bindLong(5, entity.uid);
- }
- });
- this.__upsertAdapterOfBook = new EntityUpsertAdapter<Book>(new EntityInsertAdapter<Book>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "INSERT INTO `Book` (`bookId`,`uid`) VALUES (?,?)";
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, @NonNull final User entity) {
+ statement.bindLong(1, entity.uid);
+ statement.bindText(2, entity.name);
+ statement.bindText(3, entity.getLastName());
+ statement.bindLong(4, entity.age);
+ statement.bindLong(5, entity.uid);
+ }
+ });
+ this.__upsertAdapterOfBook = new EntityUpsertAdapter<Book>(new EntityInsertAdapter<Book>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "INSERT INTO `Book` (`bookId`,`uid`) VALUES (?,?)";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, @NonNull final Book entity) {
- statement.bindLong(1, entity.bookId);
- statement.bindLong(2, entity.uid);
- }
- }, new EntityDeleteOrUpdateAdapter<Book>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "UPDATE `Book` SET `bookId` = ?,`uid` = ? WHERE `bookId` = ?";
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, @NonNull final Book entity) {
+ statement.bindLong(1, entity.bookId);
+ statement.bindLong(2, entity.uid);
+ }
+ }, new EntityDeleteOrUpdateAdapter<Book>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "UPDATE `Book` SET `bookId` = ?,`uid` = ? WHERE `bookId` = ?";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, @NonNull final Book entity) {
- statement.bindLong(1, entity.bookId);
- statement.bindLong(2, entity.uid);
- statement.bindLong(3, entity.bookId);
- }
- });
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, @NonNull final Book entity) {
+ statement.bindLong(1, entity.bookId);
+ statement.bindLong(2, entity.uid);
+ statement.bindLong(3, entity.bookId);
+ }
+ });
+ }
- @Override
- public void upsertUser(final User user) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __upsertAdapterOfUser.upsert(_connection, user);
- return null;
- }
- });
- }
+ @Override
+ public void upsertUser(final User user) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __upsertAdapterOfUser.upsert(_connection, user);
+ return null;
+ }
+ });
+ }
- @Override
- public void upsertUsers(final User user1, final List<User> others) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __upsertAdapterOfUser.upsert(_connection, user1);
- __upsertAdapterOfUser.upsert(_connection, others);
- return null;
- }
- });
- }
+ @Override
+ public void upsertUsers(final User user1, final List<User> others) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __upsertAdapterOfUser.upsert(_connection, user1);
+ __upsertAdapterOfUser.upsert(_connection, others);
+ return null;
+ }
+ });
+ }
- @Override
- public void upsertUsers(final User[] users) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __upsertAdapterOfUser.upsert(_connection, users);
- return null;
- }
- });
- }
+ @Override
+ public void upsertUsers(final User[] users) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __upsertAdapterOfUser.upsert(_connection, users);
+ return null;
+ }
+ });
+ }
- @Override
- public void upsertTwoUsers(final User userOne, final User userTwo) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __upsertAdapterOfUser.upsert(_connection, userOne);
- __upsertAdapterOfUser.upsert(_connection, userTwo);
- return null;
- }
- });
- }
+ @Override
+ public void upsertTwoUsers(final User userOne, final User userTwo) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __upsertAdapterOfUser.upsert(_connection, userOne);
+ __upsertAdapterOfUser.upsert(_connection, userTwo);
+ return null;
+ }
+ });
+ }
- @Override
- public void upsertUserAndBook(final User user, final Book book) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __upsertAdapterOfUser.upsert(_connection, user);
- __upsertAdapterOfBook.upsert(_connection, book);
- return null;
- }
- });
- }
+ @Override
+ public void upsertUserAndBook(final User user, final Book book) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __upsertAdapterOfUser.upsert(_connection, user);
+ __upsertAdapterOfBook.upsert(_connection, book);
+ return null;
+ }
+ });
+ }
- @Override
- public long upsertAndReturnId(final User user) {
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Long>() {
- @Override
- @NonNull
- public Long invoke(@NonNull final SQLiteConnection _connection) {
- return __upsertAdapterOfUser.upsertAndReturnId(_connection, user);
- }
- });
- }
+ @Override
+ public long upsertAndReturnId(final User user) {
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Long>() {
+ @Override
+ @NonNull
+ public Long invoke(@NonNull final SQLiteConnection _connection) {
+ return __upsertAdapterOfUser.upsertAndReturnId(_connection, user);
+ }
+ });
+ }
- @Override
- public long[] upsertAndReturnIdsArray(final User[] users) {
- return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, long[]>() {
- @Override
- @NonNull
- public long[] invoke(@NonNull final SQLiteConnection _connection) {
- return __upsertAdapterOfUser.upsertAndReturnIdsArray(_connection, users);
- }
- });
- }
+ @Override
+ public long[] upsertAndReturnIdsArray(final User[] users) {
+ return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, long[]>() {
+ @Override
+ @NonNull
+ public long[] invoke(@NonNull final SQLiteConnection _connection) {
+ return __upsertAdapterOfUser.upsertAndReturnIdsArray(_connection, users);
+ }
+ });
+ }
- @NonNull
- public static List<Class<?>> getRequiredConverters() {
- return Collections.emptyList();
- }
-}
\ No newline at end of file
+ @NonNull
+ public static List<Class<?>> getRequiredConverters() {
+ return Collections.emptyList();
+ }
+}
diff --git a/room/room-compiler/src/test/test-data/daoWriter/output/ksp/WriterDao.java b/room/room-compiler/src/test/test-data/daoWriter/output/ksp/WriterDao.java
index 80b3ed3..2ed9e20 100644
--- a/room/room-compiler/src/test/test-data/daoWriter/output/ksp/WriterDao.java
+++ b/room/room-compiler/src/test/test-data/daoWriter/output/ksp/WriterDao.java
@@ -19,143 +19,143 @@
@Generated("androidx.room.RoomProcessor")
@SuppressWarnings({"unchecked", "deprecation", "removal"})
public final class WriterDao_Impl implements WriterDao {
- private final RoomDatabase __db;
+ private final RoomDatabase __db;
- private final EntityInsertAdapter<User> __insertAdapterOfUser;
+ private final EntityInsertAdapter<User> __insertAdapterOfUser;
- private final EntityInsertAdapter<User> __insertAdapterOfUser_1;
+ private final EntityInsertAdapter<User> __insertAdapterOfUser_1;
- private final EntityInsertAdapter<User> __insertAdapterOfUser_2;
+ private final EntityInsertAdapter<User> __insertAdapterOfUser_2;
- private final EntityInsertAdapter<Book> __insertAdapterOfBook;
+ private final EntityInsertAdapter<Book> __insertAdapterOfBook;
- public WriterDao_Impl(@NonNull final RoomDatabase __db) {
- this.__db = __db;
- this.__insertAdapterOfUser = new EntityInsertAdapter<User>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "INSERT OR ABORT INTO `User` (`uid`,`name`,`lastName`,`ageColumn`) VALUES (?,?,?,?)";
- }
+ public WriterDao_Impl(@NonNull final RoomDatabase __db) {
+ this.__db = __db;
+ this.__insertAdapterOfUser = new EntityInsertAdapter<User>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "INSERT OR ABORT INTO `User` (`uid`,`name`,`lastName`,`ageColumn`) VALUES (?,?,?,?)";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, @NonNull final User entity) {
- statement.bindLong(1, entity.uid);
- statement.bindText(2, entity.name);
- statement.bindText(3, entity.getLastName());
- statement.bindLong(4, entity.age);
- }
- };
- this.__insertAdapterOfUser_1 = new EntityInsertAdapter<User>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "INSERT OR REPLACE INTO `User` (`uid`,`name`,`lastName`,`ageColumn`) VALUES (?,?,?,?)";
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, @NonNull final User entity) {
+ statement.bindLong(1, entity.uid);
+ statement.bindText(2, entity.name);
+ statement.bindText(3, entity.getLastName());
+ statement.bindLong(4, entity.age);
+ }
+ };
+ this.__insertAdapterOfUser_1 = new EntityInsertAdapter<User>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "INSERT OR REPLACE INTO `User` (`uid`,`name`,`lastName`,`ageColumn`) VALUES (?,?,?,?)";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, @NonNull final User entity) {
- statement.bindLong(1, entity.uid);
- statement.bindText(2, entity.name);
- statement.bindText(3, entity.getLastName());
- statement.bindLong(4, entity.age);
- }
- };
- this.__insertAdapterOfUser_2 = new EntityInsertAdapter<User>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "INSERT INTO `User` (`uid`,`name`,`lastName`,`ageColumn`) VALUES (?,?,?,?)";
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, @NonNull final User entity) {
+ statement.bindLong(1, entity.uid);
+ statement.bindText(2, entity.name);
+ statement.bindText(3, entity.getLastName());
+ statement.bindLong(4, entity.age);
+ }
+ };
+ this.__insertAdapterOfUser_2 = new EntityInsertAdapter<User>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "INSERT INTO `User` (`uid`,`name`,`lastName`,`ageColumn`) VALUES (?,?,?,?)";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, @NonNull final User entity) {
- statement.bindLong(1, entity.uid);
- statement.bindText(2, entity.name);
- statement.bindText(3, entity.getLastName());
- statement.bindLong(4, entity.age);
- }
- };
- this.__insertAdapterOfBook = new EntityInsertAdapter<Book>() {
- @Override
- @NonNull
- protected String createQuery() {
- return "INSERT OR ABORT INTO `Book` (`bookId`,`uid`) VALUES (?,?)";
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, @NonNull final User entity) {
+ statement.bindLong(1, entity.uid);
+ statement.bindText(2, entity.name);
+ statement.bindText(3, entity.getLastName());
+ statement.bindLong(4, entity.age);
+ }
+ };
+ this.__insertAdapterOfBook = new EntityInsertAdapter<Book>() {
+ @Override
+ @NonNull
+ protected String createQuery() {
+ return "INSERT OR ABORT INTO `Book` (`bookId`,`uid`) VALUES (?,?)";
+ }
- @Override
- protected void bind(@NonNull final SQLiteStatement statement, @NonNull final Book entity) {
- statement.bindLong(1, entity.bookId);
- statement.bindLong(2, entity.uid);
- }
- };
- }
+ @Override
+ protected void bind(@NonNull final SQLiteStatement statement, @NonNull final Book entity) {
+ statement.bindLong(1, entity.bookId);
+ statement.bindLong(2, entity.uid);
+ }
+ };
+ }
- @Override
- public void insertUser(final User user) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __insertAdapterOfUser.insert(_connection, user);
- return null;
- }
- });
- }
+ @Override
+ public void insertUser(final User user) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __insertAdapterOfUser.insert(_connection, user);
+ return null;
+ }
+ });
+ }
- @Override
- public void insertUsers(final User user1, final List<User> others) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __insertAdapterOfUser.insert(_connection, user1);
- __insertAdapterOfUser.insert(_connection, others);
- return null;
- }
- });
- }
+ @Override
+ public void insertUsers(final User user1, final List<User> others) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __insertAdapterOfUser.insert(_connection, user1);
+ __insertAdapterOfUser.insert(_connection, others);
+ return null;
+ }
+ });
+ }
- @Override
- public void insertUsers(final User[] users) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __insertAdapterOfUser_1.insert(_connection, users);
- return null;
- }
- });
- }
+ @Override
+ public void insertUsers(final User[] users) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __insertAdapterOfUser_1.insert(_connection, users);
+ return null;
+ }
+ });
+ }
- @Override
- public void insertTwoUsers(final User userOne, final User userTwo) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __insertAdapterOfUser_2.insert(_connection, userOne);
- __insertAdapterOfUser_2.insert(_connection, userTwo);
- return null;
- }
- });
- }
+ @Override
+ public void insertTwoUsers(final User userOne, final User userTwo) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __insertAdapterOfUser_2.insert(_connection, userOne);
+ __insertAdapterOfUser_2.insert(_connection, userTwo);
+ return null;
+ }
+ });
+ }
- @Override
- public void insertUserAndBook(final User user, final Book book) {
- DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
- @Override
- @NonNull
- public Void invoke(@NonNull final SQLiteConnection _connection) {
- __insertAdapterOfUser.insert(_connection, user);
- __insertAdapterOfBook.insert(_connection, book);
- return null;
- }
- });
- }
+ @Override
+ public void insertUserAndBook(final User user, final Book book) {
+ DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
+ @Override
+ @NonNull
+ public Void invoke(@NonNull final SQLiteConnection _connection) {
+ __insertAdapterOfUser.insert(_connection, user);
+ __insertAdapterOfBook.insert(_connection, book);
+ return null;
+ }
+ });
+ }
- @NonNull
- public static List<Class<?>> getRequiredConverters() {
- return Collections.emptyList();
- }
-}
\ No newline at end of file
+ @NonNull
+ public static List<Class<?>> getRequiredConverters() {
+ return Collections.emptyList();
+ }
+}