1 package foo.bar; 2 3 import androidx.annotation.NonNull; 4 import androidx.room.EntityDeleteOrUpdateAdapter; 5 import androidx.room.EntityInsertAdapter; 6 import androidx.room.EntityUpsertAdapter; 7 import androidx.room.RoomDatabase; 8 import androidx.room.util.DBUtil; 9 import androidx.sqlite.SQLiteConnection; 10 import androidx.sqlite.SQLiteStatement; 11 import java.lang.Class; 12 import java.lang.Long; 13 import java.lang.Override; 14 import java.lang.String; 15 import java.lang.SuppressWarnings; 16 import java.lang.Void; 17 import java.util.Collections; 18 import java.util.List; 19 import javax.annotation.processing.Generated; 20 import kotlin.jvm.functions.Function1; 21 22 @Generated("androidx.room.RoomProcessor") 23 @SuppressWarnings({"unchecked", "deprecation", "removal"}) 24 public final class UpsertDao_Impl implements UpsertDao { 25 private final RoomDatabase __db; 26 27 private final EntityUpsertAdapter<User> __upsertAdapterOfUser; 28 29 private final EntityUpsertAdapter<Book> __upsertAdapterOfBook; 30 UpsertDao_Impl(@onNull final RoomDatabase __db)31 public UpsertDao_Impl(@NonNull final RoomDatabase __db) { 32 this.__db = __db; 33 this.__upsertAdapterOfUser = new EntityUpsertAdapter<User>(new EntityInsertAdapter<User>() { 34 @Override 35 @NonNull 36 protected String createQuery() { 37 return "INSERT INTO `User` (`uid`,`name`,`lastName`,`ageColumn`) VALUES (?,?,?,?)"; 38 } 39 40 @Override 41 protected void bind(@NonNull final SQLiteStatement statement, final User entity) { 42 statement.bindLong(1, entity.uid); 43 if (entity.name == null) { 44 statement.bindNull(2); 45 } else { 46 statement.bindText(2, entity.name); 47 } 48 if (entity.getLastName() == null) { 49 statement.bindNull(3); 50 } else { 51 statement.bindText(3, entity.getLastName()); 52 } 53 statement.bindLong(4, entity.age); 54 } 55 }, new EntityDeleteOrUpdateAdapter<User>() { 56 @Override 57 @NonNull 58 protected String createQuery() { 59 return "UPDATE `User` SET `uid` = ?,`name` = ?,`lastName` = ?,`ageColumn` = ? WHERE `uid` = ?"; 60 } 61 62 @Override 63 protected void bind(@NonNull final SQLiteStatement statement, final User entity) { 64 statement.bindLong(1, entity.uid); 65 if (entity.name == null) { 66 statement.bindNull(2); 67 } else { 68 statement.bindText(2, entity.name); 69 } 70 if (entity.getLastName() == null) { 71 statement.bindNull(3); 72 } else { 73 statement.bindText(3, entity.getLastName()); 74 } 75 statement.bindLong(4, entity.age); 76 statement.bindLong(5, entity.uid); 77 } 78 }); 79 this.__upsertAdapterOfBook = new EntityUpsertAdapter<Book>(new EntityInsertAdapter<Book>() { 80 @Override 81 @NonNull 82 protected String createQuery() { 83 return "INSERT INTO `Book` (`bookId`,`uid`) VALUES (?,?)"; 84 } 85 86 @Override 87 protected void bind(@NonNull final SQLiteStatement statement, final Book entity) { 88 statement.bindLong(1, entity.bookId); 89 statement.bindLong(2, entity.uid); 90 } 91 }, new EntityDeleteOrUpdateAdapter<Book>() { 92 @Override 93 @NonNull 94 protected String createQuery() { 95 return "UPDATE `Book` SET `bookId` = ?,`uid` = ? WHERE `bookId` = ?"; 96 } 97 98 @Override 99 protected void bind(@NonNull final SQLiteStatement statement, final Book entity) { 100 statement.bindLong(1, entity.bookId); 101 statement.bindLong(2, entity.uid); 102 statement.bindLong(3, entity.bookId); 103 } 104 }); 105 } 106 107 @Override upsertUser(final User user)108 public void upsertUser(final User user) { 109 DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() { 110 @Override 111 @NonNull 112 public Void invoke(@NonNull final SQLiteConnection _connection) { 113 __upsertAdapterOfUser.upsert(_connection, user); 114 return null; 115 } 116 }); 117 } 118 119 @Override upsertUsers(final User user1, final List<User> others)120 public void upsertUsers(final User user1, final List<User> others) { 121 DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() { 122 @Override 123 @NonNull 124 public Void invoke(@NonNull final SQLiteConnection _connection) { 125 __upsertAdapterOfUser.upsert(_connection, user1); 126 __upsertAdapterOfUser.upsert(_connection, others); 127 return null; 128 } 129 }); 130 } 131 132 @Override upsertUsers(final User[] users)133 public void upsertUsers(final User[] users) { 134 DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() { 135 @Override 136 @NonNull 137 public Void invoke(@NonNull final SQLiteConnection _connection) { 138 __upsertAdapterOfUser.upsert(_connection, users); 139 return null; 140 } 141 }); 142 } 143 144 @Override upsertTwoUsers(final User userOne, final User userTwo)145 public void upsertTwoUsers(final User userOne, final User userTwo) { 146 DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() { 147 @Override 148 @NonNull 149 public Void invoke(@NonNull final SQLiteConnection _connection) { 150 __upsertAdapterOfUser.upsert(_connection, userOne); 151 __upsertAdapterOfUser.upsert(_connection, userTwo); 152 return null; 153 } 154 }); 155 } 156 157 @Override upsertUserAndBook(final User user, final Book book)158 public void upsertUserAndBook(final User user, final Book book) { 159 DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() { 160 @Override 161 @NonNull 162 public Void invoke(@NonNull final SQLiteConnection _connection) { 163 __upsertAdapterOfUser.upsert(_connection, user); 164 __upsertAdapterOfBook.upsert(_connection, book); 165 return null; 166 } 167 }); 168 } 169 170 @Override upsertAndReturnId(final User user)171 public long upsertAndReturnId(final User user) { 172 return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Long>() { 173 @Override 174 @NonNull 175 public Long invoke(@NonNull final SQLiteConnection _connection) { 176 return __upsertAdapterOfUser.upsertAndReturnId(_connection, user); 177 } 178 }); 179 } 180 181 @Override 182 public long[] upsertAndReturnIdsArray(final User[] users) { 183 return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, long[]>() { 184 @Override 185 @NonNull 186 public long[] invoke(@NonNull final SQLiteConnection _connection) { 187 return __upsertAdapterOfUser.upsertAndReturnIdsArray(_connection, users); 188 } 189 }); 190 } 191 192 @NonNull 193 public static List<Class<?>> getRequiredConverters() { 194 return Collections.emptyList(); 195 } 196 } 197