<lambda>null1 import androidx.room.RoomDatabase
2 import androidx.room.util.ByteArrayWrapper
3 import androidx.room.util.appendPlaceholders
4 import androidx.room.util.getColumnIndex
5 import androidx.room.util.getColumnIndexOrThrow
6 import androidx.room.util.performBlocking
7 import androidx.room.util.recursiveFetchMap
8 import androidx.sqlite.SQLiteConnection
9 import androidx.sqlite.SQLiteStatement
10 import javax.`annotation`.processing.Generated
11 import kotlin.ByteArray
12 import kotlin.Int
13 import kotlin.Long
14 import kotlin.String
15 import kotlin.Suppress
16 import kotlin.collections.List
17 import kotlin.collections.MutableMap
18 import kotlin.collections.Set
19 import kotlin.collections.mutableMapOf
20 import kotlin.reflect.KClass
21 import kotlin.text.StringBuilder
22 
23 @Generated(value = ["androidx.room.RoomProcessor"])
24 @Suppress(names = ["UNCHECKED_CAST", "DEPRECATION", "REDUNDANT_PROJECTION", "REMOVAL"])
25 public class MyDao_Impl(
26   __db: RoomDatabase,
27 ) : MyDao {
28   private val __db: RoomDatabase
29   init {
30     this.__db = __db
31   }
32 
33   public override fun getSongsWithArtist(): SongWithArtist {
34     val _sql: String = "SELECT * FROM Song"
35     return performBlocking(__db, true, false) { _connection ->
36       val _stmt: SQLiteStatement = _connection.prepare(_sql)
37       try {
38         val _columnIndexOfSongId: Int = getColumnIndexOrThrow(_stmt, "songId")
39         val _columnIndexOfArtistKey: Int = getColumnIndexOrThrow(_stmt, "artistKey")
40         val _collectionArtist: MutableMap<ByteArrayWrapper, Artist?> = mutableMapOf()
41         while (_stmt.step()) {
42           val _tmpKey: ByteArrayWrapper
43           _tmpKey = ByteArrayWrapper(_stmt.getBlob(_columnIndexOfArtistKey))
44           _collectionArtist.put(_tmpKey, null)
45         }
46         _stmt.reset()
47         __fetchRelationshipArtistAsArtist(_connection, _collectionArtist)
48         val _result: SongWithArtist
49         if (_stmt.step()) {
50           val _tmpSong: Song
51           val _tmpSongId: Long
52           _tmpSongId = _stmt.getLong(_columnIndexOfSongId)
53           val _tmpArtistKey: ByteArray
54           _tmpArtistKey = _stmt.getBlob(_columnIndexOfArtistKey)
55           _tmpSong = Song(_tmpSongId,_tmpArtistKey)
56           val _tmpArtist: Artist?
57           val _tmpKey_1: ByteArrayWrapper
58           _tmpKey_1 = ByteArrayWrapper(_stmt.getBlob(_columnIndexOfArtistKey))
59           _tmpArtist = _collectionArtist.get(_tmpKey_1)
60           if (_tmpArtist == null) {
61             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'.")
62           }
63           _result = SongWithArtist(_tmpSong,_tmpArtist)
64         } else {
65           error("The query result was empty, but expected a single row to return a NON-NULL object of type <SongWithArtist>.")
66         }
67         _result
68       } finally {
69         _stmt.close()
70       }
71     }
72   }
73 
74   private fun __fetchRelationshipArtistAsArtist(_connection: SQLiteConnection, _map: MutableMap<ByteArrayWrapper, Artist?>) {
75     val __mapKeySet: Set<ByteArrayWrapper> = _map.keys
76     if (__mapKeySet.isEmpty()) {
77       return
78     }
79     if (_map.size > 999) {
80       recursiveFetchMap(_map, false) { _tmpMap ->
81         __fetchRelationshipArtistAsArtist(_connection, _tmpMap)
82       }
83       return
84     }
85     val _stringBuilder: StringBuilder = StringBuilder()
86     _stringBuilder.append("SELECT `artistId` FROM `Artist` WHERE `artistId` IN (")
87     val _inputSize: Int = __mapKeySet.size
88     appendPlaceholders(_stringBuilder, _inputSize)
89     _stringBuilder.append(")")
90     val _sql: String = _stringBuilder.toString()
91     val _stmt: SQLiteStatement = _connection.prepare(_sql)
92     var _argIndex: Int = 1
93     for (_item: ByteArrayWrapper in __mapKeySet) {
94       _stmt.bindBlob(_argIndex, _item.array)
95       _argIndex++
96     }
97     try {
98       val _itemKeyIndex: Int = getColumnIndex(_stmt, "artistId")
99       if (_itemKeyIndex == -1) {
100         return
101       }
102       val _columnIndexOfArtistId: Int = 0
103       while (_stmt.step()) {
104         val _tmpKey: ByteArrayWrapper
105         _tmpKey = ByteArrayWrapper(_stmt.getBlob(_itemKeyIndex))
106         if (_map.containsKey(_tmpKey)) {
107           val _item_1: Artist
108           val _tmpArtistId: ByteArray
109           _tmpArtistId = _stmt.getBlob(_columnIndexOfArtistId)
110           _item_1 = Artist(_tmpArtistId)
111           _map.put(_tmpKey, _item_1)
112         }
113       }
114     } finally {
115       _stmt.close()
116     }
117   }
118 
119   public companion object {
120     public fun getRequiredConverters(): List<KClass<*>> = emptyList()
121   }
122 }
123