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 |
| 8 | import java.lang.Class |
| 9 | import java.util.LinkedHashMap |
| 10 | import javax.`annotation`.processing.Generated |
| 11 | import kotlin.Int |
| 12 | import kotlin.String |
| 13 | import kotlin.Suppress |
| 14 | import kotlin.collections.List |
| 15 | import kotlin.collections.MutableMap |
| 16 | import kotlin.jvm.JvmStatic |
| 17 | |
| 18 | @Generated(value = ["androidx.room.RoomProcessor"]) |
elifbilgin | d46e8c1 | 2023-01-17 09:32:11 -0800 | [diff] [blame] | 19 | @Suppress(names = ["UNCHECKED_CAST", "DEPRECATION", "REDUNDANT_PROJECTION"]) |
elifbilgin | 4c09727 | 2022-11-22 16:15:47 -0800 | [diff] [blame] | 20 | public class MyDao_Impl( |
| 21 | __db: RoomDatabase, |
| 22 | ) : MyDao { |
| 23 | private val __db: RoomDatabase |
| 24 | init { |
| 25 | this.__db = __db |
| 26 | } |
| 27 | |
| 28 | public override fun getSongsWithArtist(): ImmutableMap<Song, Artist> { |
| 29 | val _sql: String = "SELECT * FROM Song JOIN Artist ON Song.artistKey = Artist.artistId" |
| 30 | val _statement: RoomSQLiteQuery = acquire(_sql, 0) |
| 31 | __db.assertNotSuspendingTransaction() |
| 32 | val _cursor: Cursor = query(__db, _statement, false, null) |
| 33 | try { |
| 34 | val _cursorIndexOfSongId: Int = getColumnIndexOrThrow(_cursor, "songId") |
| 35 | val _cursorIndexOfArtistKey: Int = getColumnIndexOrThrow(_cursor, "artistKey") |
| 36 | val _cursorIndexOfArtistId: Int = getColumnIndexOrThrow(_cursor, "artistId") |
| 37 | val _mapResult: MutableMap<Song, Artist> = LinkedHashMap<Song, Artist>() |
| 38 | while (_cursor.moveToNext()) { |
| 39 | val _key: Song |
| 40 | val _tmpSongId: String |
| 41 | _tmpSongId = _cursor.getString(_cursorIndexOfSongId) |
| 42 | val _tmpArtistKey: String |
| 43 | _tmpArtistKey = _cursor.getString(_cursorIndexOfArtistKey) |
| 44 | _key = Song(_tmpSongId,_tmpArtistKey) |
| 45 | if (_cursor.isNull(_cursorIndexOfArtistId)) { |
elifbilgin | 22935ce | 2023-07-25 14:14:10 -0700 | [diff] [blame^] | 46 | 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] | 47 | } |
| 48 | val _value: Artist |
| 49 | val _tmpArtistId: String |
| 50 | _tmpArtistId = _cursor.getString(_cursorIndexOfArtistId) |
| 51 | _value = Artist(_tmpArtistId) |
| 52 | if (!_mapResult.containsKey(_key)) { |
| 53 | _mapResult.put(_key, _value) |
| 54 | } |
| 55 | } |
| 56 | val _result: ImmutableMap<Song, Artist> = ImmutableMap.copyOf(_mapResult) |
| 57 | return _result |
| 58 | } finally { |
| 59 | _cursor.close() |
| 60 | _statement.release() |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | public companion object { |
| 65 | @JvmStatic |
| 66 | public fun getRequiredConverters(): List<Class<*>> = emptyList() |
| 67 | } |
| 68 | } |