blob: dee390f2aa54db484890db7dd8347c08a1ec12a5 [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 _tmpKey = _cursor.getLong(_cursorIndexOfArtistKey)
46 _collectionArtist.put(_tmpKey, null)
47 }
48 _cursor.moveToPosition(-1)
49 __fetchRelationshipArtistAsArtist(_collectionArtist)
50 val _result: SongWithArtist
51 if (_cursor.moveToFirst()) {
52 val _tmpSong: Song
53 val _tmpSongId: Long
54 _tmpSongId = _cursor.getLong(_cursorIndexOfSongId)
55 val _tmpArtistKey: Long
56 _tmpArtistKey = _cursor.getLong(_cursorIndexOfArtistKey)
57 _tmpSong = Song(_tmpSongId,_tmpArtistKey)
58 val _tmpArtist: Artist?
59 val _tmpKey_1: Long
60 _tmpKey_1 = _cursor.getLong(_cursorIndexOfArtistKey)
61 _tmpArtist = _collectionArtist.get(_tmpKey_1)
62 if (_tmpArtist == null) {
elifbilgin22935ce2023-07-25 14:14:10 -070063 error("Relationship item 'artist' was expected to be NON-NULL but is NULL in @Relation involving a parent column named 'artistKey' and entityColumn named 'artistId'.")
Daniel Santiago Rivera8aab02df2022-11-03 11:12:49 -040064 }
65 _result = SongWithArtist(_tmpSong,_tmpArtist)
66 } else {
elifbilgin22935ce2023-07-25 14:14:10 -070067 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 -040068 }
69 return _result
70 } finally {
71 _cursor.close()
72 _statement.release()
73 }
74 }
75
76 public override fun getArtistAndSongs(): ArtistAndSongs {
77 val _sql: String = "SELECT * FROM Artist"
78 val _statement: RoomSQLiteQuery = acquire(_sql, 0)
79 __db.assertNotSuspendingTransaction()
80 val _cursor: Cursor = query(__db, _statement, true, null)
81 try {
82 val _cursorIndexOfArtistId: Int = getColumnIndexOrThrow(_cursor, "artistId")
83 val _collectionSongs: HashMap<Long, ArrayList<Song>> = HashMap<Long, ArrayList<Song>>()
84 while (_cursor.moveToNext()) {
85 val _tmpKey: Long
86 _tmpKey = _cursor.getLong(_cursorIndexOfArtistId)
87 if (!_collectionSongs.containsKey(_tmpKey)) {
88 _collectionSongs.put(_tmpKey, ArrayList<Song>())
89 }
90 }
91 _cursor.moveToPosition(-1)
92 __fetchRelationshipSongAsSong(_collectionSongs)
93 val _result: ArtistAndSongs
94 if (_cursor.moveToFirst()) {
95 val _tmpArtist: Artist
96 val _tmpArtistId: Long
97 _tmpArtistId = _cursor.getLong(_cursorIndexOfArtistId)
98 _tmpArtist = Artist(_tmpArtistId)
99 val _tmpSongsCollection: ArrayList<Song>
100 val _tmpKey_1: Long
101 _tmpKey_1 = _cursor.getLong(_cursorIndexOfArtistId)
102 _tmpSongsCollection = _collectionSongs.getValue(_tmpKey_1)
103 _result = ArtistAndSongs(_tmpArtist,_tmpSongsCollection)
104 } else {
elifbilgin22935ce2023-07-25 14:14:10 -0700105 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 -0400106 }
107 return _result
108 } finally {
109 _cursor.close()
110 _statement.release()
111 }
112 }
113
114 public override fun getPlaylistAndSongs(): PlaylistAndSongs {
115 val _sql: String = "SELECT * FROM Playlist"
116 val _statement: RoomSQLiteQuery = acquire(_sql, 0)
117 __db.assertNotSuspendingTransaction()
118 val _cursor: Cursor = query(__db, _statement, true, null)
119 try {
120 val _cursorIndexOfPlaylistId: Int = getColumnIndexOrThrow(_cursor, "playlistId")
121 val _collectionSongs: HashMap<Long, ArrayList<Song>> = HashMap<Long, ArrayList<Song>>()
122 while (_cursor.moveToNext()) {
123 val _tmpKey: Long
124 _tmpKey = _cursor.getLong(_cursorIndexOfPlaylistId)
125 if (!_collectionSongs.containsKey(_tmpKey)) {
126 _collectionSongs.put(_tmpKey, ArrayList<Song>())
127 }
128 }
129 _cursor.moveToPosition(-1)
130 __fetchRelationshipSongAsSong_1(_collectionSongs)
131 val _result: PlaylistAndSongs
132 if (_cursor.moveToFirst()) {
133 val _tmpPlaylist: Playlist
134 val _tmpPlaylistId: Long
135 _tmpPlaylistId = _cursor.getLong(_cursorIndexOfPlaylistId)
136 _tmpPlaylist = Playlist(_tmpPlaylistId)
137 val _tmpSongsCollection: ArrayList<Song>
138 val _tmpKey_1: Long
139 _tmpKey_1 = _cursor.getLong(_cursorIndexOfPlaylistId)
140 _tmpSongsCollection = _collectionSongs.getValue(_tmpKey_1)
141 _result = PlaylistAndSongs(_tmpPlaylist,_tmpSongsCollection)
142 } else {
elifbilgin22935ce2023-07-25 14:14:10 -0700143 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 -0400144 }
145 return _result
146 } finally {
147 _cursor.close()
148 _statement.release()
149 }
150 }
151
Daniel Santiago Riveraa6dec5a2023-05-02 15:09:07 -0400152 private fun __fetchRelationshipArtistAsArtist(_map: HashMap<Long, Artist?>) {
Daniel Santiago Rivera8aab02df2022-11-03 11:12:49 -0400153 val __mapKeySet: Set<Long> = _map.keys
154 if (__mapKeySet.isEmpty()) {
155 return
156 }
157 if (_map.size > RoomDatabase.MAX_BIND_PARAMETER_CNT) {
158 recursiveFetchHashMap(_map, false) {
159 __fetchRelationshipArtistAsArtist(it)
160 }
161 return
162 }
163 val _stringBuilder: StringBuilder = newStringBuilder()
164 _stringBuilder.append("SELECT `artistId` FROM `Artist` WHERE `artistId` IN (")
165 val _inputSize: Int = __mapKeySet.size
166 appendPlaceholders(_stringBuilder, _inputSize)
167 _stringBuilder.append(")")
168 val _sql: String = _stringBuilder.toString()
169 val _argCount: Int = 0 + _inputSize
170 val _stmt: RoomSQLiteQuery = acquire(_sql, _argCount)
171 var _argIndex: Int = 1
172 for (_item: Long in __mapKeySet) {
173 _stmt.bindLong(_argIndex, _item)
174 _argIndex++
175 }
176 val _cursor: Cursor = query(__db, _stmt, false, null)
177 try {
178 val _itemKeyIndex: Int = getColumnIndex(_cursor, "artistId")
179 if (_itemKeyIndex == -1) {
180 return
181 }
182 val _cursorIndexOfArtistId: Int = 0
183 while (_cursor.moveToNext()) {
184 val _tmpKey: Long
185 _tmpKey = _cursor.getLong(_itemKeyIndex)
186 if (_map.containsKey(_tmpKey)) {
187 val _item_1: Artist
188 val _tmpArtistId: Long
189 _tmpArtistId = _cursor.getLong(_cursorIndexOfArtistId)
190 _item_1 = Artist(_tmpArtistId)
191 _map.put(_tmpKey, _item_1)
192 }
193 }
194 } finally {
195 _cursor.close()
196 }
197 }
198
Daniel Santiago Riveraa6dec5a2023-05-02 15:09:07 -0400199 private fun __fetchRelationshipSongAsSong(_map: HashMap<Long, ArrayList<Song>>) {
Daniel Santiago Rivera8aab02df2022-11-03 11:12:49 -0400200 val __mapKeySet: Set<Long> = _map.keys
201 if (__mapKeySet.isEmpty()) {
202 return
203 }
204 if (_map.size > RoomDatabase.MAX_BIND_PARAMETER_CNT) {
205 recursiveFetchHashMap(_map, true) {
206 __fetchRelationshipSongAsSong(it)
207 }
208 return
209 }
210 val _stringBuilder: StringBuilder = newStringBuilder()
211 _stringBuilder.append("SELECT `songId`,`artistKey` FROM `Song` WHERE `artistKey` IN (")
212 val _inputSize: Int = __mapKeySet.size
213 appendPlaceholders(_stringBuilder, _inputSize)
214 _stringBuilder.append(")")
215 val _sql: String = _stringBuilder.toString()
216 val _argCount: Int = 0 + _inputSize
217 val _stmt: RoomSQLiteQuery = acquire(_sql, _argCount)
218 var _argIndex: Int = 1
219 for (_item: Long in __mapKeySet) {
220 _stmt.bindLong(_argIndex, _item)
221 _argIndex++
222 }
223 val _cursor: Cursor = query(__db, _stmt, false, null)
224 try {
225 val _itemKeyIndex: Int = getColumnIndex(_cursor, "artistKey")
226 if (_itemKeyIndex == -1) {
227 return
228 }
229 val _cursorIndexOfSongId: Int = 0
230 val _cursorIndexOfArtistKey: Int = 1
231 while (_cursor.moveToNext()) {
232 val _tmpKey: Long
233 _tmpKey = _cursor.getLong(_itemKeyIndex)
234 val _tmpRelation: ArrayList<Song>? = _map.get(_tmpKey)
235 if (_tmpRelation != null) {
236 val _item_1: Song
237 val _tmpSongId: Long
238 _tmpSongId = _cursor.getLong(_cursorIndexOfSongId)
239 val _tmpArtistKey: Long
240 _tmpArtistKey = _cursor.getLong(_cursorIndexOfArtistKey)
241 _item_1 = Song(_tmpSongId,_tmpArtistKey)
242 _tmpRelation.add(_item_1)
243 }
244 }
245 } finally {
246 _cursor.close()
247 }
248 }
249
Daniel Santiago Riveraa6dec5a2023-05-02 15:09:07 -0400250 private fun __fetchRelationshipSongAsSong_1(_map: HashMap<Long, ArrayList<Song>>) {
Daniel Santiago Rivera8aab02df2022-11-03 11:12:49 -0400251 val __mapKeySet: Set<Long> = _map.keys
252 if (__mapKeySet.isEmpty()) {
253 return
254 }
255 if (_map.size > RoomDatabase.MAX_BIND_PARAMETER_CNT) {
256 recursiveFetchHashMap(_map, true) {
257 __fetchRelationshipSongAsSong_1(it)
258 }
259 return
260 }
261 val _stringBuilder: StringBuilder = newStringBuilder()
262 _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 (")
263 val _inputSize: Int = __mapKeySet.size
264 appendPlaceholders(_stringBuilder, _inputSize)
265 _stringBuilder.append(")")
266 val _sql: String = _stringBuilder.toString()
267 val _argCount: Int = 0 + _inputSize
268 val _stmt: RoomSQLiteQuery = acquire(_sql, _argCount)
269 var _argIndex: Int = 1
270 for (_item: Long in __mapKeySet) {
271 _stmt.bindLong(_argIndex, _item)
272 _argIndex++
273 }
274 val _cursor: Cursor = query(__db, _stmt, false, null)
275 try {
276 // _junction.playlistKey
277 val _itemKeyIndex: Int = 2
278 if (_itemKeyIndex == -1) {
279 return
280 }
281 val _cursorIndexOfSongId: Int = 0
282 val _cursorIndexOfArtistKey: Int = 1
283 while (_cursor.moveToNext()) {
284 val _tmpKey: Long
285 _tmpKey = _cursor.getLong(_itemKeyIndex)
286 val _tmpRelation: ArrayList<Song>? = _map.get(_tmpKey)
287 if (_tmpRelation != null) {
288 val _item_1: Song
289 val _tmpSongId: Long
290 _tmpSongId = _cursor.getLong(_cursorIndexOfSongId)
291 val _tmpArtistKey: Long
292 _tmpArtistKey = _cursor.getLong(_cursorIndexOfArtistKey)
293 _item_1 = Song(_tmpSongId,_tmpArtistKey)
294 _tmpRelation.add(_item_1)
295 }
296 }
297 } finally {
298 _cursor.close()
299 }
300 }
301
302 public companion object {
303 @JvmStatic
304 public fun getRequiredConverters(): List<Class<*>> = emptyList()
305 }
306}