blob: 9cb1cc6de144963b549052ae4337ca838183c458 [file] [log] [blame]
Daniel Santiago Rivera8aab02df2022-11-03 11:12:49 -04001import android.database.Cursor
2import androidx.room.RoomDatabase
3import androidx.room.RoomSQLiteQuery
4import androidx.room.RoomSQLiteQuery.Companion.acquire
5import androidx.room.util.appendPlaceholders
6import androidx.room.util.getColumnIndex
7import androidx.room.util.getColumnIndexOrThrow
8import androidx.room.util.newStringBuilder
9import androidx.room.util.query
10import androidx.room.util.recursiveFetchHashMap
11import java.lang.Class
12import java.lang.StringBuilder
13import java.util.ArrayList
14import java.util.HashMap
15import javax.`annotation`.processing.Generated
16import kotlin.Int
17import kotlin.Long
18import kotlin.String
19import kotlin.Suppress
Daniel Santiago Rivera8aab02df2022-11-03 11:12:49 -040020import kotlin.collections.List
21import kotlin.collections.Set
22import kotlin.jvm.JvmStatic
23
24@Generated(value = ["androidx.room.RoomProcessor"])
elifbilgind46e8c12023-01-17 09:32:11 -080025@Suppress(names = ["UNCHECKED_CAST", "DEPRECATION", "REDUNDANT_PROJECTION"])
Daniel Santiago Riverae695d182022-11-08 21:12:14 -050026public class MyDao_Impl(
27 __db: RoomDatabase,
28) : MyDao {
Daniel Santiago Rivera8aab02df2022-11-03 11:12:49 -040029 private val __db: RoomDatabase
Daniel Santiago Riverae695d182022-11-08 21:12:14 -050030 init {
Daniel Santiago Rivera8aab02df2022-11-03 11:12:49 -040031 this.__db = __db
32 }
33
34 public override fun getSongsWithArtist(): SongWithArtist {
35 val _sql: String = "SELECT * FROM Song"
36 val _statement: RoomSQLiteQuery = acquire(_sql, 0)
37 __db.assertNotSuspendingTransaction()
38 val _cursor: Cursor = query(__db, _statement, true, null)
39 try {
40 val _cursorIndexOfSongId: Int = getColumnIndexOrThrow(_cursor, "songId")
41 val _cursorIndexOfArtistKey: Int = getColumnIndexOrThrow(_cursor, "artistKey")
42 val _collectionArtist: HashMap<Long, Artist?> = HashMap<Long, Artist?>()
43 while (_cursor.moveToNext()) {
44 val _tmpKey: Long?
45 if (_cursor.isNull(_cursorIndexOfArtistKey)) {
46 _tmpKey = null
47 } else {
48 _tmpKey = _cursor.getLong(_cursorIndexOfArtistKey)
49 }
50 if (_tmpKey != null) {
51 _collectionArtist.put(_tmpKey, null)
52 }
53 }
54 _cursor.moveToPosition(-1)
55 __fetchRelationshipArtistAsArtist(_collectionArtist)
56 val _result: SongWithArtist
57 if (_cursor.moveToFirst()) {
58 val _tmpSong: Song
59 val _tmpSongId: Long
60 _tmpSongId = _cursor.getLong(_cursorIndexOfSongId)
61 val _tmpArtistKey: Long?
62 if (_cursor.isNull(_cursorIndexOfArtistKey)) {
63 _tmpArtistKey = null
64 } else {
65 _tmpArtistKey = _cursor.getLong(_cursorIndexOfArtistKey)
66 }
67 _tmpSong = Song(_tmpSongId,_tmpArtistKey)
68 val _tmpArtist: Artist?
69 val _tmpKey_1: Long?
70 if (_cursor.isNull(_cursorIndexOfArtistKey)) {
71 _tmpKey_1 = null
72 } else {
73 _tmpKey_1 = _cursor.getLong(_cursorIndexOfArtistKey)
74 }
75 if (_tmpKey_1 != null) {
76 _tmpArtist = _collectionArtist.get(_tmpKey_1)
77 } else {
78 _tmpArtist = null
79 }
80 _result = SongWithArtist(_tmpSong,_tmpArtist)
81 } else {
elifbilgin22935ce2023-07-25 14:14:10 -070082 error("The query result was empty, but expected a single row to return a NON-NULL object of type <SongWithArtist>.")
Daniel Santiago Rivera8aab02df2022-11-03 11:12:49 -040083 }
84 return _result
85 } finally {
86 _cursor.close()
87 _statement.release()
88 }
89 }
90
91 public override fun getArtistAndSongs(): ArtistAndSongs {
92 val _sql: String = "SELECT * FROM Artist"
93 val _statement: RoomSQLiteQuery = acquire(_sql, 0)
94 __db.assertNotSuspendingTransaction()
95 val _cursor: Cursor = query(__db, _statement, true, null)
96 try {
97 val _cursorIndexOfArtistId: Int = getColumnIndexOrThrow(_cursor, "artistId")
98 val _collectionSongs: HashMap<Long, ArrayList<Song>> = HashMap<Long, ArrayList<Song>>()
99 while (_cursor.moveToNext()) {
100 val _tmpKey: Long
101 _tmpKey = _cursor.getLong(_cursorIndexOfArtistId)
102 if (!_collectionSongs.containsKey(_tmpKey)) {
103 _collectionSongs.put(_tmpKey, ArrayList<Song>())
104 }
105 }
106 _cursor.moveToPosition(-1)
107 __fetchRelationshipSongAsSong(_collectionSongs)
108 val _result: ArtistAndSongs
109 if (_cursor.moveToFirst()) {
110 val _tmpArtist: Artist
111 val _tmpArtistId: Long
112 _tmpArtistId = _cursor.getLong(_cursorIndexOfArtistId)
113 _tmpArtist = Artist(_tmpArtistId)
114 val _tmpSongsCollection: ArrayList<Song>
115 val _tmpKey_1: Long
116 _tmpKey_1 = _cursor.getLong(_cursorIndexOfArtistId)
117 _tmpSongsCollection = _collectionSongs.getValue(_tmpKey_1)
118 _result = ArtistAndSongs(_tmpArtist,_tmpSongsCollection)
119 } else {
elifbilgin22935ce2023-07-25 14:14:10 -0700120 error("The query result was empty, but expected a single row to return a NON-NULL object of type <ArtistAndSongs>.")
Daniel Santiago Rivera8aab02df2022-11-03 11:12:49 -0400121 }
122 return _result
123 } finally {
124 _cursor.close()
125 _statement.release()
126 }
127 }
128
129 public override fun getPlaylistAndSongs(): PlaylistAndSongs {
130 val _sql: String = "SELECT * FROM Playlist"
131 val _statement: RoomSQLiteQuery = acquire(_sql, 0)
132 __db.assertNotSuspendingTransaction()
133 val _cursor: Cursor = query(__db, _statement, true, null)
134 try {
135 val _cursorIndexOfPlaylistId: Int = getColumnIndexOrThrow(_cursor, "playlistId")
136 val _collectionSongs: HashMap<Long, ArrayList<Song>> = HashMap<Long, ArrayList<Song>>()
137 while (_cursor.moveToNext()) {
138 val _tmpKey: Long
139 _tmpKey = _cursor.getLong(_cursorIndexOfPlaylistId)
140 if (!_collectionSongs.containsKey(_tmpKey)) {
141 _collectionSongs.put(_tmpKey, ArrayList<Song>())
142 }
143 }
144 _cursor.moveToPosition(-1)
145 __fetchRelationshipSongAsSong_1(_collectionSongs)
146 val _result: PlaylistAndSongs
147 if (_cursor.moveToFirst()) {
148 val _tmpPlaylist: Playlist
149 val _tmpPlaylistId: Long
150 _tmpPlaylistId = _cursor.getLong(_cursorIndexOfPlaylistId)
151 _tmpPlaylist = Playlist(_tmpPlaylistId)
152 val _tmpSongsCollection: ArrayList<Song>
153 val _tmpKey_1: Long
154 _tmpKey_1 = _cursor.getLong(_cursorIndexOfPlaylistId)
155 _tmpSongsCollection = _collectionSongs.getValue(_tmpKey_1)
156 _result = PlaylistAndSongs(_tmpPlaylist,_tmpSongsCollection)
157 } else {
elifbilgin22935ce2023-07-25 14:14:10 -0700158 error("The query result was empty, but expected a single row to return a NON-NULL object of type <PlaylistAndSongs>.")
Daniel Santiago Rivera8aab02df2022-11-03 11:12:49 -0400159 }
160 return _result
161 } finally {
162 _cursor.close()
163 _statement.release()
164 }
165 }
166
Daniel Santiago Riveraa6dec5a2023-05-02 15:09:07 -0400167 private fun __fetchRelationshipArtistAsArtist(_map: HashMap<Long, Artist?>) {
Daniel Santiago Rivera8aab02df2022-11-03 11:12:49 -0400168 val __mapKeySet: Set<Long> = _map.keys
169 if (__mapKeySet.isEmpty()) {
170 return
171 }
172 if (_map.size > RoomDatabase.MAX_BIND_PARAMETER_CNT) {
173 recursiveFetchHashMap(_map, false) {
174 __fetchRelationshipArtistAsArtist(it)
175 }
176 return
177 }
178 val _stringBuilder: StringBuilder = newStringBuilder()
179 _stringBuilder.append("SELECT `artistId` FROM `Artist` WHERE `artistId` IN (")
180 val _inputSize: Int = __mapKeySet.size
181 appendPlaceholders(_stringBuilder, _inputSize)
182 _stringBuilder.append(")")
183 val _sql: String = _stringBuilder.toString()
184 val _argCount: Int = 0 + _inputSize
185 val _stmt: RoomSQLiteQuery = acquire(_sql, _argCount)
186 var _argIndex: Int = 1
187 for (_item: Long in __mapKeySet) {
188 _stmt.bindLong(_argIndex, _item)
189 _argIndex++
190 }
191 val _cursor: Cursor = query(__db, _stmt, false, null)
192 try {
193 val _itemKeyIndex: Int = getColumnIndex(_cursor, "artistId")
194 if (_itemKeyIndex == -1) {
195 return
196 }
197 val _cursorIndexOfArtistId: Int = 0
198 while (_cursor.moveToNext()) {
199 val _tmpKey: Long
200 _tmpKey = _cursor.getLong(_itemKeyIndex)
201 if (_map.containsKey(_tmpKey)) {
202 val _item_1: Artist?
203 val _tmpArtistId: Long
204 _tmpArtistId = _cursor.getLong(_cursorIndexOfArtistId)
205 _item_1 = Artist(_tmpArtistId)
206 _map.put(_tmpKey, _item_1)
207 }
208 }
209 } finally {
210 _cursor.close()
211 }
212 }
213
Daniel Santiago Riveraa6dec5a2023-05-02 15:09:07 -0400214 private fun __fetchRelationshipSongAsSong(_map: HashMap<Long, ArrayList<Song>>) {
Daniel Santiago Rivera8aab02df2022-11-03 11:12:49 -0400215 val __mapKeySet: Set<Long> = _map.keys
216 if (__mapKeySet.isEmpty()) {
217 return
218 }
219 if (_map.size > RoomDatabase.MAX_BIND_PARAMETER_CNT) {
220 recursiveFetchHashMap(_map, true) {
221 __fetchRelationshipSongAsSong(it)
222 }
223 return
224 }
225 val _stringBuilder: StringBuilder = newStringBuilder()
226 _stringBuilder.append("SELECT `songId`,`artistKey` FROM `Song` WHERE `artistKey` IN (")
227 val _inputSize: Int = __mapKeySet.size
228 appendPlaceholders(_stringBuilder, _inputSize)
229 _stringBuilder.append(")")
230 val _sql: String = _stringBuilder.toString()
231 val _argCount: Int = 0 + _inputSize
232 val _stmt: RoomSQLiteQuery = acquire(_sql, _argCount)
233 var _argIndex: Int = 1
234 for (_item: Long in __mapKeySet) {
235 _stmt.bindLong(_argIndex, _item)
236 _argIndex++
237 }
238 val _cursor: Cursor = query(__db, _stmt, false, null)
239 try {
240 val _itemKeyIndex: Int = getColumnIndex(_cursor, "artistKey")
241 if (_itemKeyIndex == -1) {
242 return
243 }
244 val _cursorIndexOfSongId: Int = 0
245 val _cursorIndexOfArtistKey: Int = 1
246 while (_cursor.moveToNext()) {
247 val _tmpKey: Long?
248 if (_cursor.isNull(_itemKeyIndex)) {
249 _tmpKey = null
250 } else {
251 _tmpKey = _cursor.getLong(_itemKeyIndex)
252 }
253 if (_tmpKey != null) {
254 val _tmpRelation: ArrayList<Song>? = _map.get(_tmpKey)
255 if (_tmpRelation != null) {
256 val _item_1: Song
257 val _tmpSongId: Long
258 _tmpSongId = _cursor.getLong(_cursorIndexOfSongId)
259 val _tmpArtistKey: Long?
260 if (_cursor.isNull(_cursorIndexOfArtistKey)) {
261 _tmpArtistKey = null
262 } else {
263 _tmpArtistKey = _cursor.getLong(_cursorIndexOfArtistKey)
264 }
265 _item_1 = Song(_tmpSongId,_tmpArtistKey)
266 _tmpRelation.add(_item_1)
267 }
268 }
269 }
270 } finally {
271 _cursor.close()
272 }
273 }
274
Daniel Santiago Riveraa6dec5a2023-05-02 15:09:07 -0400275 private fun __fetchRelationshipSongAsSong_1(_map: HashMap<Long, ArrayList<Song>>) {
Daniel Santiago Rivera8aab02df2022-11-03 11:12:49 -0400276 val __mapKeySet: Set<Long> = _map.keys
277 if (__mapKeySet.isEmpty()) {
278 return
279 }
280 if (_map.size > RoomDatabase.MAX_BIND_PARAMETER_CNT) {
281 recursiveFetchHashMap(_map, true) {
282 __fetchRelationshipSongAsSong_1(it)
283 }
284 return
285 }
286 val _stringBuilder: StringBuilder = newStringBuilder()
287 _stringBuilder.append("SELECT `Song`.`songId` AS `songId`,`Song`.`artistKey` AS `artistKey`,_junction.`playlistKey` FROM `PlaylistSongXRef` AS _junction INNER JOIN `Song` ON (_junction.`songKey` = `Song`.`songId`) WHERE _junction.`playlistKey` IN (")
288 val _inputSize: Int = __mapKeySet.size
289 appendPlaceholders(_stringBuilder, _inputSize)
290 _stringBuilder.append(")")
291 val _sql: String = _stringBuilder.toString()
292 val _argCount: Int = 0 + _inputSize
293 val _stmt: RoomSQLiteQuery = acquire(_sql, _argCount)
294 var _argIndex: Int = 1
295 for (_item: Long in __mapKeySet) {
296 _stmt.bindLong(_argIndex, _item)
297 _argIndex++
298 }
299 val _cursor: Cursor = query(__db, _stmt, false, null)
300 try {
301 // _junction.playlistKey
302 val _itemKeyIndex: Int = 2
303 if (_itemKeyIndex == -1) {
304 return
305 }
306 val _cursorIndexOfSongId: Int = 0
307 val _cursorIndexOfArtistKey: Int = 1
308 while (_cursor.moveToNext()) {
309 val _tmpKey: Long
310 _tmpKey = _cursor.getLong(_itemKeyIndex)
311 val _tmpRelation: ArrayList<Song>? = _map.get(_tmpKey)
312 if (_tmpRelation != null) {
313 val _item_1: Song
314 val _tmpSongId: Long
315 _tmpSongId = _cursor.getLong(_cursorIndexOfSongId)
316 val _tmpArtistKey: Long?
317 if (_cursor.isNull(_cursorIndexOfArtistKey)) {
318 _tmpArtistKey = null
319 } else {
320 _tmpArtistKey = _cursor.getLong(_cursorIndexOfArtistKey)
321 }
322 _item_1 = Song(_tmpSongId,_tmpArtistKey)
323 _tmpRelation.add(_item_1)
324 }
325 }
326 } finally {
327 _cursor.close()
328 }
329 }
330
331 public companion object {
332 @JvmStatic
333 public fun getRequiredConverters(): List<Class<*>> = emptyList()
334 }
335}