elifbilgin | 4c09727 | 2022-11-22 16:15:47 -0800 | [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.getColumnIndexOrThrow |
| 6 | import androidx.room.util.query |
| 7 | import com.google.common.collect.ImmutableMap |
elifbilgin | 4c09727 | 2022-11-22 16:15:47 -0800 | [diff] [blame] | 8 | import javax.`annotation`.processing.Generated |
| 9 | import kotlin.Int |
| 10 | import kotlin.String |
| 11 | import kotlin.Suppress |
elifbilgin | 4a463c0 | 2024-03-07 17:11:35 -0800 | [diff] [blame] | 12 | import kotlin.collections.LinkedHashMap |
elifbilgin | 4c09727 | 2022-11-22 16:15:47 -0800 | [diff] [blame] | 13 | import kotlin.collections.List |
| 14 | import kotlin.collections.MutableMap |
Daniel Santiago Rivera | 691d576 | 2023-12-20 13:33:24 -0500 | [diff] [blame] | 15 | import kotlin.reflect.KClass |
elifbilgin | 4c09727 | 2022-11-22 16:15:47 -0800 | [diff] [blame] | 16 | |
| 17 | @Generated(value = ["androidx.room.RoomProcessor"]) |
Aurimas Liutikas | 4e41da2 | 2023-12-13 15:38:28 -0800 | [diff] [blame^] | 18 | @Suppress(names = ["UNCHECKED_CAST", "DEPRECATION", "REDUNDANT_PROJECTION", "REMOVAL"]) |
elifbilgin | 4c09727 | 2022-11-22 16:15:47 -0800 | [diff] [blame] | 19 | public class MyDao_Impl( |
Daniel Santiago Rivera | f69df89 | 2023-12-20 14:04:16 -0500 | [diff] [blame] | 20 | __db: RoomDatabase, |
elifbilgin | 4c09727 | 2022-11-22 16:15:47 -0800 | [diff] [blame] | 21 | ) : MyDao { |
Daniel Santiago Rivera | f69df89 | 2023-12-20 14:04:16 -0500 | [diff] [blame] | 22 | private val __db: RoomDatabase |
| 23 | init { |
| 24 | this.__db = __db |
| 25 | } |
elifbilgin | 4c09727 | 2022-11-22 16:15:47 -0800 | [diff] [blame] | 26 | |
Daniel Santiago Rivera | f69df89 | 2023-12-20 14:04:16 -0500 | [diff] [blame] | 27 | public override fun getSongsWithArtist(): ImmutableMap<Song, Artist> { |
| 28 | val _sql: String = "SELECT * FROM Song JOIN Artist ON Song.artistKey = Artist.artistId" |
| 29 | val _statement: RoomSQLiteQuery = acquire(_sql, 0) |
| 30 | __db.assertNotSuspendingTransaction() |
| 31 | val _cursor: Cursor = query(__db, _statement, false, null) |
| 32 | try { |
| 33 | val _cursorIndexOfSongId: Int = getColumnIndexOrThrow(_cursor, "songId") |
| 34 | val _cursorIndexOfArtistKey: Int = getColumnIndexOrThrow(_cursor, "artistKey") |
| 35 | val _cursorIndexOfArtistId: Int = getColumnIndexOrThrow(_cursor, "artistId") |
| 36 | val _mapResult: MutableMap<Song, Artist> = LinkedHashMap<Song, Artist>() |
| 37 | while (_cursor.moveToNext()) { |
| 38 | val _key: Song |
| 39 | val _tmpSongId: String |
| 40 | _tmpSongId = _cursor.getString(_cursorIndexOfSongId) |
| 41 | val _tmpArtistKey: String |
| 42 | _tmpArtistKey = _cursor.getString(_cursorIndexOfArtistKey) |
| 43 | _key = Song(_tmpSongId,_tmpArtistKey) |
| 44 | if (_cursor.isNull(_cursorIndexOfArtistId)) { |
| 45 | error("The column(s) of the map value object of type 'Artist' are NULL but the map's value type argument expect it to be NON-NULL") |
elifbilgin | 4c09727 | 2022-11-22 16:15:47 -0800 | [diff] [blame] | 46 | } |
Daniel Santiago Rivera | f69df89 | 2023-12-20 14:04:16 -0500 | [diff] [blame] | 47 | val _value: Artist |
| 48 | val _tmpArtistId: String |
| 49 | _tmpArtistId = _cursor.getString(_cursorIndexOfArtistId) |
| 50 | _value = Artist(_tmpArtistId) |
| 51 | if (!_mapResult.containsKey(_key)) { |
| 52 | _mapResult.put(_key, _value) |
| 53 | } |
| 54 | } |
| 55 | val _result: ImmutableMap<Song, Artist> = ImmutableMap.copyOf(_mapResult) |
| 56 | return _result |
| 57 | } finally { |
| 58 | _cursor.close() |
| 59 | _statement.release() |
elifbilgin | 4c09727 | 2022-11-22 16:15:47 -0800 | [diff] [blame] | 60 | } |
Daniel Santiago Rivera | f69df89 | 2023-12-20 14:04:16 -0500 | [diff] [blame] | 61 | } |
elifbilgin | 4c09727 | 2022-11-22 16:15:47 -0800 | [diff] [blame] | 62 | |
Daniel Santiago Rivera | f69df89 | 2023-12-20 14:04:16 -0500 | [diff] [blame] | 63 | public companion object { |
Daniel Santiago Rivera | 691d576 | 2023-12-20 13:33:24 -0500 | [diff] [blame] | 64 | public fun getRequiredConverters(): List<KClass<*>> = emptyList() |
Daniel Santiago Rivera | f69df89 | 2023-12-20 14:04:16 -0500 | [diff] [blame] | 65 | } |
| 66 | } |