1 package foo.bar;
2 
3 import androidx.annotation.NonNull;
4 import androidx.annotation.Nullable;
5 import androidx.room.EntityDeleteOrUpdateAdapter;
6 import androidx.room.RoomDatabase;
7 import androidx.room.RxRoom;
8 import androidx.room.util.DBUtil;
9 import androidx.room.util.SQLiteConnectionUtil;
10 import androidx.sqlite.SQLiteConnection;
11 import androidx.sqlite.SQLiteStatement;
12 import io.reactivex.Completable;
13 import io.reactivex.Maybe;
14 import io.reactivex.Single;
15 import java.lang.Class;
16 import java.lang.Integer;
17 import java.lang.Override;
18 import java.lang.String;
19 import java.lang.SuppressWarnings;
20 import java.lang.Void;
21 import java.util.Collections;
22 import java.util.List;
23 import javax.annotation.processing.Generated;
24 import kotlin.Unit;
25 import kotlin.jvm.functions.Function1;
26 
27 @Generated("androidx.room.RoomProcessor")
28 @SuppressWarnings({"unchecked", "deprecation", "removal"})
29 public final class UpdateDao_Impl implements UpdateDao {
30   private final RoomDatabase __db;
31 
32   private final EntityDeleteOrUpdateAdapter<User> __updateAdapterOfUser;
33 
34   private final EntityDeleteOrUpdateAdapter<User> __updateAdapterOfUser_1;
35 
36   private final EntityDeleteOrUpdateAdapter<MultiPKeyEntity> __updateAdapterOfMultiPKeyEntity;
37 
38   private final EntityDeleteOrUpdateAdapter<Book> __updateAdapterOfBook;
39 
UpdateDao_Impl(@onNull final RoomDatabase __db)40   public UpdateDao_Impl(@NonNull final RoomDatabase __db) {
41     this.__db = __db;
42     this.__updateAdapterOfUser = new EntityDeleteOrUpdateAdapter<User>() {
43       @Override
44       @NonNull
45       protected String createQuery() {
46         return "UPDATE OR ABORT `User` SET `uid` = ?,`name` = ?,`lastName` = ?,`ageColumn` = ? WHERE `uid` = ?";
47       }
48 
49       @Override
50       protected void bind(@NonNull final SQLiteStatement statement, final User entity) {
51         statement.bindLong(1, entity.uid);
52         if (entity.name == null) {
53           statement.bindNull(2);
54         } else {
55           statement.bindText(2, entity.name);
56         }
57         if (entity.getLastName() == null) {
58           statement.bindNull(3);
59         } else {
60           statement.bindText(3, entity.getLastName());
61         }
62         statement.bindLong(4, entity.age);
63         statement.bindLong(5, entity.uid);
64       }
65     };
66     this.__updateAdapterOfUser_1 = new EntityDeleteOrUpdateAdapter<User>() {
67       @Override
68       @NonNull
69       protected String createQuery() {
70         return "UPDATE `User` SET `uid` = ?,`name` = ?,`lastName` = ?,`ageColumn` = ? WHERE `uid` = ?";
71       }
72 
73       @Override
74       protected void bind(@NonNull final SQLiteStatement statement, final User entity) {
75         statement.bindLong(1, entity.uid);
76         if (entity.name == null) {
77           statement.bindNull(2);
78         } else {
79           statement.bindText(2, entity.name);
80         }
81         if (entity.getLastName() == null) {
82           statement.bindNull(3);
83         } else {
84           statement.bindText(3, entity.getLastName());
85         }
86         statement.bindLong(4, entity.age);
87         statement.bindLong(5, entity.uid);
88       }
89     };
90     this.__updateAdapterOfMultiPKeyEntity = new EntityDeleteOrUpdateAdapter<MultiPKeyEntity>() {
91       @Override
92       @NonNull
93       protected String createQuery() {
94         return "UPDATE OR ABORT `MultiPKeyEntity` SET `name` = ?,`lastName` = ? WHERE `name` = ? AND `lastName` = ?";
95       }
96 
97       @Override
98       protected void bind(@NonNull final SQLiteStatement statement, final MultiPKeyEntity entity) {
99         if (entity.name == null) {
100           statement.bindNull(1);
101         } else {
102           statement.bindText(1, entity.name);
103         }
104         if (entity.lastName == null) {
105           statement.bindNull(2);
106         } else {
107           statement.bindText(2, entity.lastName);
108         }
109         if (entity.name == null) {
110           statement.bindNull(3);
111         } else {
112           statement.bindText(3, entity.name);
113         }
114         if (entity.lastName == null) {
115           statement.bindNull(4);
116         } else {
117           statement.bindText(4, entity.lastName);
118         }
119       }
120     };
121     this.__updateAdapterOfBook = new EntityDeleteOrUpdateAdapter<Book>() {
122       @Override
123       @NonNull
124       protected String createQuery() {
125         return "UPDATE OR ABORT `Book` SET `bookId` = ?,`uid` = ? WHERE `bookId` = ?";
126       }
127 
128       @Override
129       protected void bind(@NonNull final SQLiteStatement statement, final Book entity) {
130         statement.bindLong(1, entity.bookId);
131         statement.bindLong(2, entity.uid);
132         statement.bindLong(3, entity.bookId);
133       }
134     };
135   }
136 
137   @Override
updateUser(final User user)138   public void updateUser(final User user) {
139     DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
140       @Override
141       @NonNull
142       public Void invoke(@NonNull final SQLiteConnection _connection) {
143         __updateAdapterOfUser.handle(_connection, user);
144         return null;
145       }
146     });
147   }
148 
149   @Override
updateUsers(final User user1, final List<User> others)150   public void updateUsers(final User user1, final List<User> others) {
151     DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
152       @Override
153       @NonNull
154       public Void invoke(@NonNull final SQLiteConnection _connection) {
155         __updateAdapterOfUser.handle(_connection, user1);
156         __updateAdapterOfUser.handleMultiple(_connection, others);
157         return null;
158       }
159     });
160   }
161 
162   @Override
updateArrayOfUsers(final User[] users)163   public void updateArrayOfUsers(final User[] users) {
164     DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
165       @Override
166       @NonNull
167       public Void invoke(@NonNull final SQLiteConnection _connection) {
168         __updateAdapterOfUser.handleMultiple(_connection, users);
169         return null;
170       }
171     });
172   }
173 
174   @Override
updateTwoUsers(final User userOne, final User userTwo)175   public void updateTwoUsers(final User userOne, final User userTwo) {
176     DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
177       @Override
178       @NonNull
179       public Void invoke(@NonNull final SQLiteConnection _connection) {
180         __updateAdapterOfUser_1.handle(_connection, userOne);
181         __updateAdapterOfUser_1.handle(_connection, userTwo);
182         return null;
183       }
184     });
185   }
186 
187   @Override
updateUserAndReturnCount(final User user)188   public int updateUserAndReturnCount(final User user) {
189     return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
190       @Override
191       @NonNull
192       public Integer invoke(@NonNull final SQLiteConnection _connection) {
193         int _result = 0;
194         _result += __updateAdapterOfUser.handle(_connection, user);
195         return _result;
196       }
197     });
198   }
199 
200   @Override
201   public int updateUserAndReturnCount(final User user1, final List<User> others) {
202     return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
203       @Override
204       @NonNull
205       public Integer invoke(@NonNull final SQLiteConnection _connection) {
206         int _result = 0;
207         _result += __updateAdapterOfUser.handle(_connection, user1);
208         _result += __updateAdapterOfUser.handleMultiple(_connection, others);
209         return _result;
210       }
211     });
212   }
213 
214   @Override
215   public int updateUserAndReturnCount(final User[] users) {
216     return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
217       @Override
218       @NonNull
219       public Integer invoke(@NonNull final SQLiteConnection _connection) {
220         int _result = 0;
221         _result += __updateAdapterOfUser.handleMultiple(_connection, users);
222         return _result;
223       }
224     });
225   }
226 
227   @Override
228   public Integer updateUserAndReturnCountObject(final User user) {
229     return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
230       @Override
231       @NonNull
232       public Integer invoke(@NonNull final SQLiteConnection _connection) {
233         int _result = 0;
234         _result += __updateAdapterOfUser.handle(_connection, user);
235         return _result;
236       }
237     });
238   }
239 
240   @Override
241   public Completable updateUserAndReturnCountCompletable(final User user) {
242     return RxRoom.createCompletable(__db, false, true, new Function1<SQLiteConnection, Unit>() {
243       @Override
244       @NonNull
245       public Unit invoke(@NonNull final SQLiteConnection _connection) {
246         __updateAdapterOfUser.handle(_connection, user);
247         return Unit.INSTANCE;
248       }
249     });
250   }
251 
252   @Override
253   public Single<Integer> updateUserAndReturnCountSingle(final User user) {
254     return RxRoom.createSingle(__db, false, true, new Function1<SQLiteConnection, Integer>() {
255       @Override
256       @Nullable
257       public Integer invoke(@NonNull final SQLiteConnection _connection) {
258         int _result = 0;
259         _result += __updateAdapterOfUser.handle(_connection, user);
260         return _result;
261       }
262     });
263   }
264 
265   @Override
266   public Maybe<Integer> updateUserAndReturnCountMaybe(final User user) {
267     return RxRoom.createMaybe(__db, false, true, new Function1<SQLiteConnection, Integer>() {
268       @Override
269       @Nullable
270       public Integer invoke(@NonNull final SQLiteConnection _connection) {
271         int _result = 0;
272         _result += __updateAdapterOfUser.handle(_connection, user);
273         return _result;
274       }
275     });
276   }
277 
278   @Override
279   public int multiPKey(final MultiPKeyEntity entity) {
280     return DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Integer>() {
281       @Override
282       @NonNull
283       public Integer invoke(@NonNull final SQLiteConnection _connection) {
284         int _result = 0;
285         _result += __updateAdapterOfMultiPKeyEntity.handle(_connection, entity);
286         return _result;
287       }
288     });
289   }
290 
291   @Override
292   public void updateUserAndBook(final User user, final Book book) {
293     DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
294       @Override
295       @NonNull
296       public Void invoke(@NonNull final SQLiteConnection _connection) {
297         __updateAdapterOfUser.handle(_connection, user);
298         __updateAdapterOfBook.handle(_connection, book);
299         return null;
300       }
301     });
302   }
303 
304   @Override
305   public void ageUserByUid(final String uid) {
306     final String _sql = "UPDATE User SET ageColumn = ageColumn + 1 WHERE uid = ?";
307     DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
308       @Override
309       @NonNull
310       public Void invoke(@NonNull final SQLiteConnection _connection) {
311         final SQLiteStatement _stmt = _connection.prepare(_sql);
312         try {
313           int _argIndex = 1;
314           if (uid == null) {
315             _stmt.bindNull(_argIndex);
316           } else {
317             _stmt.bindText(_argIndex, uid);
318           }
319           _stmt.step();
320           return null;
321         } finally {
322           _stmt.close();
323         }
324       }
325     });
326   }
327 
328   @Override
329   public void ageUserAll() {
330     final String _sql = "UPDATE User SET ageColumn = ageColumn + 1";
331     DBUtil.performBlocking(__db, false, true, new Function1<SQLiteConnection, Void>() {
332       @Override
333       @NonNull
334       public Void invoke(@NonNull final SQLiteConnection _connection) {
335         final SQLiteStatement _stmt = _connection.prepare(_sql);
336         try {
337           _stmt.step();
338           return null;
339         } finally {
340           _stmt.close();
341         }
342       }
343     });
344   }
345 
346   @Override
347   public Completable ageUserAllCompletable() {
348     final String _sql = "UPDATE User SET ageColumn = ageColumn + 1";
349     return RxRoom.createCompletable(__db, false, true, new Function1<SQLiteConnection, Unit>() {
350       @Override
351       @NonNull
352       public Unit invoke(@NonNull final SQLiteConnection _connection) {
353         final SQLiteStatement _stmt = _connection.prepare(_sql);
354         try {
355           _stmt.step();
356           return Unit.INSTANCE;
357         } finally {
358           _stmt.close();
359         }
360       }
361     });
362   }
363 
364   @Override
365   public Single<Integer> ageUserAllSingle() {
366     final String _sql = "UPDATE User SET ageColumn = ageColumn + 1";
367     return RxRoom.createSingle(__db, false, true, new Function1<SQLiteConnection, Integer>() {
368       @Override
369       @Nullable
370       public Integer invoke(@NonNull final SQLiteConnection _connection) {
371         final SQLiteStatement _stmt = _connection.prepare(_sql);
372         try {
373           _stmt.step();
374           return SQLiteConnectionUtil.getTotalChangedRows(_connection);
375         } finally {
376           _stmt.close();
377         }
378       }
379     });
380   }
381 
382   @Override
383   public Maybe<Integer> ageUserAllMaybe() {
384     final String _sql = "UPDATE User SET ageColumn = ageColumn + 1";
385     return RxRoom.createMaybe(__db, false, true, new Function1<SQLiteConnection, Integer>() {
386       @Override
387       @Nullable
388       public Integer invoke(@NonNull final SQLiteConnection _connection) {
389         final SQLiteStatement _stmt = _connection.prepare(_sql);
390         try {
391           _stmt.step();
392           return SQLiteConnectionUtil.getTotalChangedRows(_connection);
393         } finally {
394           _stmt.close();
395         }
396       }
397     });
398   }
399 
400   @NonNull
401   public static List<Class<?>> getRequiredConverters() {
402     return Collections.emptyList();
403   }
404 }
405