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 | _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) { |
elifbilgin | 22935ce | 2023-07-25 14:14:10 -0700 | [diff] [blame^] | 63 | 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 Rivera | 8aab02df | 2022-11-03 11:12:49 -0400 | [diff] [blame] | 64 | } |
| 65 | _result = SongWithArtist(_tmpSong,_tmpArtist) |
| 66 | } else { |
elifbilgin | 22935ce | 2023-07-25 14:14:10 -0700 | [diff] [blame^] | 67 | 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] | 68 | } |
| 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 { |
elifbilgin | 22935ce | 2023-07-25 14:14:10 -0700 | [diff] [blame^] | 105 | 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] | 106 | } |
| 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 { |
elifbilgin | 22935ce | 2023-07-25 14:14:10 -0700 | [diff] [blame^] | 143 | 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] | 144 | } |
| 145 | return _result |
| 146 | } finally { |
| 147 | _cursor.close() |
| 148 | _statement.release() |
| 149 | } |
| 150 | } |
| 151 | |
Daniel Santiago Rivera | a6dec5a | 2023-05-02 15:09:07 -0400 | [diff] [blame] | 152 | private fun __fetchRelationshipArtistAsArtist(_map: HashMap<Long, Artist?>) { |
Daniel Santiago Rivera | 8aab02df | 2022-11-03 11:12:49 -0400 | [diff] [blame] | 153 | 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 Rivera | a6dec5a | 2023-05-02 15:09:07 -0400 | [diff] [blame] | 199 | private fun __fetchRelationshipSongAsSong(_map: HashMap<Long, ArrayList<Song>>) { |
Daniel Santiago Rivera | 8aab02df | 2022-11-03 11:12:49 -0400 | [diff] [blame] | 200 | 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 Rivera | a6dec5a | 2023-05-02 15:09:07 -0400 | [diff] [blame] | 250 | private fun __fetchRelationshipSongAsSong_1(_map: HashMap<Long, ArrayList<Song>>) { |
Daniel Santiago Rivera | 8aab02df | 2022-11-03 11:12:49 -0400 | [diff] [blame] | 251 | 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 | } |