Daniel Santiago Rivera | 8aab02df | 2022-11-03 11:12:49 -0400 | [diff] [blame] | 1 | import android.database.Cursor |
| 2 | import androidx.room.RoomDatabase |
| 3 | import androidx.room.RoomSQLiteQuery |
| 4 | import androidx.room.RoomSQLiteQuery.Companion.acquire |
| 5 | import androidx.room.util.appendPlaceholders |
| 6 | import androidx.room.util.getColumnIndex |
| 7 | import androidx.room.util.getColumnIndexOrThrow |
| 8 | import androidx.room.util.newStringBuilder |
| 9 | import androidx.room.util.query |
| 10 | import androidx.room.util.recursiveFetchHashMap |
| 11 | import java.lang.Class |
| 12 | import java.lang.StringBuilder |
| 13 | import java.util.ArrayList |
| 14 | import java.util.HashMap |
| 15 | import javax.`annotation`.processing.Generated |
| 16 | import kotlin.Int |
| 17 | import kotlin.Long |
| 18 | import kotlin.String |
| 19 | import kotlin.Suppress |
Daniel Santiago Rivera | 8aab02df | 2022-11-03 11:12:49 -0400 | [diff] [blame] | 20 | import kotlin.collections.List |
| 21 | import kotlin.collections.Set |
| 22 | import kotlin.jvm.JvmStatic |
| 23 | |
| 24 | @Generated(value = ["androidx.room.RoomProcessor"]) |
elifbilgin | d46e8c1 | 2023-01-17 09:32:11 -0800 | [diff] [blame] | 25 | @Suppress(names = ["UNCHECKED_CAST", "DEPRECATION", "REDUNDANT_PROJECTION"]) |
Daniel Santiago Rivera | e695d18 | 2022-11-08 21:12:14 -0500 | [diff] [blame] | 26 | public class MyDao_Impl( |
| 27 | __db: RoomDatabase, |
| 28 | ) : MyDao { |
Daniel Santiago Rivera | 8aab02df | 2022-11-03 11:12:49 -0400 | [diff] [blame] | 29 | private val __db: RoomDatabase |
Daniel Santiago Rivera | e695d18 | 2022-11-08 21:12:14 -0500 | [diff] [blame] | 30 | init { |
Daniel Santiago Rivera | 8aab02df | 2022-11-03 11:12:49 -0400 | [diff] [blame] | 31 | 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 { |
elifbilgin | 22935ce | 2023-07-25 14:14:10 -0700 | [diff] [blame^] | 82 | error("The query result was empty, but expected a single row to return a NON-NULL object of type <SongWithArtist>.") |
Daniel Santiago Rivera | 8aab02df | 2022-11-03 11:12:49 -0400 | [diff] [blame] | 83 | } |
| 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 { |
elifbilgin | 22935ce | 2023-07-25 14:14:10 -0700 | [diff] [blame^] | 120 | error("The query result was empty, but expected a single row to return a NON-NULL object of type <ArtistAndSongs>.") |
Daniel Santiago Rivera | 8aab02df | 2022-11-03 11:12:49 -0400 | [diff] [blame] | 121 | } |
| 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 { |
elifbilgin | 22935ce | 2023-07-25 14:14:10 -0700 | [diff] [blame^] | 158 | error("The query result was empty, but expected a single row to return a NON-NULL object of type <PlaylistAndSongs>.") |
Daniel Santiago Rivera | 8aab02df | 2022-11-03 11:12:49 -0400 | [diff] [blame] | 159 | } |
| 160 | return _result |
| 161 | } finally { |
| 162 | _cursor.close() |
| 163 | _statement.release() |
| 164 | } |
| 165 | } |
| 166 | |
Daniel Santiago Rivera | a6dec5a | 2023-05-02 15:09:07 -0400 | [diff] [blame] | 167 | private fun __fetchRelationshipArtistAsArtist(_map: HashMap<Long, Artist?>) { |
Daniel Santiago Rivera | 8aab02df | 2022-11-03 11:12:49 -0400 | [diff] [blame] | 168 | 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 Rivera | a6dec5a | 2023-05-02 15:09:07 -0400 | [diff] [blame] | 214 | private fun __fetchRelationshipSongAsSong(_map: HashMap<Long, ArrayList<Song>>) { |
Daniel Santiago Rivera | 8aab02df | 2022-11-03 11:12:49 -0400 | [diff] [blame] | 215 | 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 Rivera | a6dec5a | 2023-05-02 15:09:07 -0400 | [diff] [blame] | 275 | private fun __fetchRelationshipSongAsSong_1(_map: HashMap<Long, ArrayList<Song>>) { |
Daniel Santiago Rivera | 8aab02df | 2022-11-03 11:12:49 -0400 | [diff] [blame] | 276 | 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 | } |