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