blob: 45e0eb13a64e0c2d42519647c2754db57b9c5779 [file] [log] [blame]
elifbilgin4c097272022-11-22 16:15:47 -08001import android.database.Cursor
2import androidx.room.RoomDatabase
3import androidx.room.RoomSQLiteQuery
4import androidx.room.RoomSQLiteQuery.Companion.acquire
5import androidx.room.util.getColumnIndexOrThrow
6import androidx.room.util.query
7import com.google.common.collect.ImmutableMap
elifbilgin4c097272022-11-22 16:15:47 -08008import javax.`annotation`.processing.Generated
9import kotlin.Int
10import kotlin.String
11import kotlin.Suppress
elifbilgin4a463c02024-03-07 17:11:35 -080012import kotlin.collections.LinkedHashMap
elifbilgin4c097272022-11-22 16:15:47 -080013import kotlin.collections.List
14import kotlin.collections.MutableMap
Daniel Santiago Rivera691d5762023-12-20 13:33:24 -050015import kotlin.reflect.KClass
elifbilgin4c097272022-11-22 16:15:47 -080016
17@Generated(value = ["androidx.room.RoomProcessor"])
Aurimas Liutikas4e41da22023-12-13 15:38:28 -080018@Suppress(names = ["UNCHECKED_CAST", "DEPRECATION", "REDUNDANT_PROJECTION", "REMOVAL"])
elifbilgin4c097272022-11-22 16:15:47 -080019public class MyDao_Impl(
Daniel Santiago Riveraf69df892023-12-20 14:04:16 -050020 __db: RoomDatabase,
elifbilgin4c097272022-11-22 16:15:47 -080021) : MyDao {
Daniel Santiago Riveraf69df892023-12-20 14:04:16 -050022 private val __db: RoomDatabase
23 init {
24 this.__db = __db
25 }
elifbilgin4c097272022-11-22 16:15:47 -080026
Daniel Santiago Riveraf69df892023-12-20 14:04:16 -050027 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")
elifbilgin4c097272022-11-22 16:15:47 -080046 }
Daniel Santiago Riveraf69df892023-12-20 14:04:16 -050047 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()
elifbilgin4c097272022-11-22 16:15:47 -080060 }
Daniel Santiago Riveraf69df892023-12-20 14:04:16 -050061 }
elifbilgin4c097272022-11-22 16:15:47 -080062
Daniel Santiago Riveraf69df892023-12-20 14:04:16 -050063 public companion object {
Daniel Santiago Rivera691d5762023-12-20 13:33:24 -050064 public fun getRequiredConverters(): List<KClass<*>> = emptyList()
Daniel Santiago Riveraf69df892023-12-20 14:04:16 -050065 }
66}