<lambda>null1 import androidx.room.RoomDatabase
2 import androidx.room.util.appendPlaceholders
3 import androidx.room.util.getColumnIndex
4 import androidx.room.util.getColumnIndexOrThrow
5 import androidx.room.util.performBlocking
6 import androidx.room.util.recursiveFetchMap
7 import androidx.sqlite.SQLiteConnection
8 import androidx.sqlite.SQLiteStatement
9 import javax.`annotation`.processing.Generated
10 import kotlin.Int
11 import kotlin.Long
12 import kotlin.String
13 import kotlin.Suppress
14 import kotlin.collections.List
15 import kotlin.collections.MutableList
16 import kotlin.collections.MutableMap
17 import kotlin.collections.Set
18 import kotlin.collections.mutableListOf
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<Long, Artist?> = mutableMapOf()
41         while (_stmt.step()) {
42           val _tmpKey: Long?
43           if (_stmt.isNull(_columnIndexOfArtistKey)) {
44             _tmpKey = null
45           } else {
46             _tmpKey = _stmt.getLong(_columnIndexOfArtistKey)
47           }
48           if (_tmpKey != null) {
49             _collectionArtist.put(_tmpKey, null)
50           }
51         }
52         _stmt.reset()
53         __fetchRelationshipArtistAsArtist(_connection, _collectionArtist)
54         val _result: SongWithArtist
55         if (_stmt.step()) {
56           val _tmpSong: Song
57           val _tmpSongId: Long
58           _tmpSongId = _stmt.getLong(_columnIndexOfSongId)
59           val _tmpArtistKey: Long?
60           if (_stmt.isNull(_columnIndexOfArtistKey)) {
61             _tmpArtistKey = null
62           } else {
63             _tmpArtistKey = _stmt.getLong(_columnIndexOfArtistKey)
64           }
65           _tmpSong = Song(_tmpSongId,_tmpArtistKey)
66           val _tmpArtist: Artist?
67           val _tmpKey_1: Long?
68           if (_stmt.isNull(_columnIndexOfArtistKey)) {
69             _tmpKey_1 = null
70           } else {
71             _tmpKey_1 = _stmt.getLong(_columnIndexOfArtistKey)
72           }
73           if (_tmpKey_1 != null) {
74             _tmpArtist = _collectionArtist.get(_tmpKey_1)
75           } else {
76             _tmpArtist = null
77           }
78           _result = SongWithArtist(_tmpSong,_tmpArtist)
79         } else {
80           error("The query result was empty, but expected a single row to return a NON-NULL object of type <SongWithArtist>.")
81         }
82         _result
83       } finally {
84         _stmt.close()
85       }
86     }
87   }
88 
89   public override fun getArtistAndSongs(): ArtistAndSongs {
90     val _sql: String = "SELECT * FROM Artist"
91     return performBlocking(__db, true, false) { _connection ->
92       val _stmt: SQLiteStatement = _connection.prepare(_sql)
93       try {
94         val _columnIndexOfArtistId: Int = getColumnIndexOrThrow(_stmt, "artistId")
95         val _collectionSongs: MutableMap<Long, MutableList<Song>> = mutableMapOf()
96         while (_stmt.step()) {
97           val _tmpKey: Long
98           _tmpKey = _stmt.getLong(_columnIndexOfArtistId)
99           if (!_collectionSongs.containsKey(_tmpKey)) {
100             _collectionSongs.put(_tmpKey, mutableListOf())
101           }
102         }
103         _stmt.reset()
104         __fetchRelationshipSongAsSong(_connection, _collectionSongs)
105         val _result: ArtistAndSongs
106         if (_stmt.step()) {
107           val _tmpArtist: Artist
108           val _tmpArtistId: Long
109           _tmpArtistId = _stmt.getLong(_columnIndexOfArtistId)
110           _tmpArtist = Artist(_tmpArtistId)
111           val _tmpSongsCollection: MutableList<Song>
112           val _tmpKey_1: Long
113           _tmpKey_1 = _stmt.getLong(_columnIndexOfArtistId)
114           _tmpSongsCollection = _collectionSongs.getValue(_tmpKey_1)
115           _result = ArtistAndSongs(_tmpArtist,_tmpSongsCollection)
116         } else {
117           error("The query result was empty, but expected a single row to return a NON-NULL object of type <ArtistAndSongs>.")
118         }
119         _result
120       } finally {
121         _stmt.close()
122       }
123     }
124   }
125 
126   public override fun getPlaylistAndSongs(): PlaylistAndSongs {
127     val _sql: String = "SELECT * FROM Playlist"
128     return performBlocking(__db, true, false) { _connection ->
129       val _stmt: SQLiteStatement = _connection.prepare(_sql)
130       try {
131         val _columnIndexOfPlaylistId: Int = getColumnIndexOrThrow(_stmt, "playlistId")
132         val _collectionSongs: MutableMap<Long, MutableList<Song>> = mutableMapOf()
133         while (_stmt.step()) {
134           val _tmpKey: Long
135           _tmpKey = _stmt.getLong(_columnIndexOfPlaylistId)
136           if (!_collectionSongs.containsKey(_tmpKey)) {
137             _collectionSongs.put(_tmpKey, mutableListOf())
138           }
139         }
140         _stmt.reset()
141         __fetchRelationshipSongAsSong_1(_connection, _collectionSongs)
142         val _result: PlaylistAndSongs
143         if (_stmt.step()) {
144           val _tmpPlaylist: Playlist
145           val _tmpPlaylistId: Long
146           _tmpPlaylistId = _stmt.getLong(_columnIndexOfPlaylistId)
147           _tmpPlaylist = Playlist(_tmpPlaylistId)
148           val _tmpSongsCollection: MutableList<Song>
149           val _tmpKey_1: Long
150           _tmpKey_1 = _stmt.getLong(_columnIndexOfPlaylistId)
151           _tmpSongsCollection = _collectionSongs.getValue(_tmpKey_1)
152           _result = PlaylistAndSongs(_tmpPlaylist,_tmpSongsCollection)
153         } else {
154           error("The query result was empty, but expected a single row to return a NON-NULL object of type <PlaylistAndSongs>.")
155         }
156         _result
157       } finally {
158         _stmt.close()
159       }
160     }
161   }
162 
163   private fun __fetchRelationshipArtistAsArtist(_connection: SQLiteConnection, _map: MutableMap<Long, Artist?>) {
164     val __mapKeySet: Set<Long> = _map.keys
165     if (__mapKeySet.isEmpty()) {
166       return
167     }
168     if (_map.size > 999) {
169       recursiveFetchMap(_map, false) { _tmpMap ->
170         __fetchRelationshipArtistAsArtist(_connection, _tmpMap)
171       }
172       return
173     }
174     val _stringBuilder: StringBuilder = StringBuilder()
175     _stringBuilder.append("SELECT `artistId` FROM `Artist` WHERE `artistId` IN (")
176     val _inputSize: Int = __mapKeySet.size
177     appendPlaceholders(_stringBuilder, _inputSize)
178     _stringBuilder.append(")")
179     val _sql: String = _stringBuilder.toString()
180     val _stmt: SQLiteStatement = _connection.prepare(_sql)
181     var _argIndex: Int = 1
182     for (_item: Long in __mapKeySet) {
183       _stmt.bindLong(_argIndex, _item)
184       _argIndex++
185     }
186     try {
187       val _itemKeyIndex: Int = getColumnIndex(_stmt, "artistId")
188       if (_itemKeyIndex == -1) {
189         return
190       }
191       val _columnIndexOfArtistId: Int = 0
192       while (_stmt.step()) {
193         val _tmpKey: Long
194         _tmpKey = _stmt.getLong(_itemKeyIndex)
195         if (_map.containsKey(_tmpKey)) {
196           val _item_1: Artist?
197           val _tmpArtistId: Long
198           _tmpArtistId = _stmt.getLong(_columnIndexOfArtistId)
199           _item_1 = Artist(_tmpArtistId)
200           _map.put(_tmpKey, _item_1)
201         }
202       }
203     } finally {
204       _stmt.close()
205     }
206   }
207 
208   private fun __fetchRelationshipSongAsSong(_connection: SQLiteConnection, _map: MutableMap<Long, MutableList<Song>>) {
209     val __mapKeySet: Set<Long> = _map.keys
210     if (__mapKeySet.isEmpty()) {
211       return
212     }
213     if (_map.size > 999) {
214       recursiveFetchMap(_map, true) { _tmpMap ->
215         __fetchRelationshipSongAsSong(_connection, _tmpMap)
216       }
217       return
218     }
219     val _stringBuilder: StringBuilder = StringBuilder()
220     _stringBuilder.append("SELECT `songId`,`artistKey` FROM `Song` WHERE `artistKey` IN (")
221     val _inputSize: Int = __mapKeySet.size
222     appendPlaceholders(_stringBuilder, _inputSize)
223     _stringBuilder.append(")")
224     val _sql: String = _stringBuilder.toString()
225     val _stmt: SQLiteStatement = _connection.prepare(_sql)
226     var _argIndex: Int = 1
227     for (_item: Long in __mapKeySet) {
228       _stmt.bindLong(_argIndex, _item)
229       _argIndex++
230     }
231     try {
232       val _itemKeyIndex: Int = getColumnIndex(_stmt, "artistKey")
233       if (_itemKeyIndex == -1) {
234         return
235       }
236       val _columnIndexOfSongId: Int = 0
237       val _columnIndexOfArtistKey: Int = 1
238       while (_stmt.step()) {
239         val _tmpKey: Long?
240         if (_stmt.isNull(_itemKeyIndex)) {
241           _tmpKey = null
242         } else {
243           _tmpKey = _stmt.getLong(_itemKeyIndex)
244         }
245         if (_tmpKey != null) {
246           val _tmpRelation: MutableList<Song>? = _map.get(_tmpKey)
247           if (_tmpRelation != null) {
248             val _item_1: Song
249             val _tmpSongId: Long
250             _tmpSongId = _stmt.getLong(_columnIndexOfSongId)
251             val _tmpArtistKey: Long?
252             if (_stmt.isNull(_columnIndexOfArtistKey)) {
253               _tmpArtistKey = null
254             } else {
255               _tmpArtistKey = _stmt.getLong(_columnIndexOfArtistKey)
256             }
257             _item_1 = Song(_tmpSongId,_tmpArtistKey)
258             _tmpRelation.add(_item_1)
259           }
260         }
261       }
262     } finally {
263       _stmt.close()
264     }
265   }
266 
267   private fun __fetchRelationshipSongAsSong_1(_connection: SQLiteConnection, _map: MutableMap<Long, MutableList<Song>>) {
268     val __mapKeySet: Set<Long> = _map.keys
269     if (__mapKeySet.isEmpty()) {
270       return
271     }
272     if (_map.size > 999) {
273       recursiveFetchMap(_map, true) { _tmpMap ->
274         __fetchRelationshipSongAsSong_1(_connection, _tmpMap)
275       }
276       return
277     }
278     val _stringBuilder: StringBuilder = StringBuilder()
279     _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 (")
280     val _inputSize: Int = __mapKeySet.size
281     appendPlaceholders(_stringBuilder, _inputSize)
282     _stringBuilder.append(")")
283     val _sql: String = _stringBuilder.toString()
284     val _stmt: SQLiteStatement = _connection.prepare(_sql)
285     var _argIndex: Int = 1
286     for (_item: Long in __mapKeySet) {
287       _stmt.bindLong(_argIndex, _item)
288       _argIndex++
289     }
290     try {
291       // _junction.playlistKey
292       val _itemKeyIndex: Int = 2
293       if (_itemKeyIndex == -1) {
294         return
295       }
296       val _columnIndexOfSongId: Int = 0
297       val _columnIndexOfArtistKey: Int = 1
298       while (_stmt.step()) {
299         val _tmpKey: Long
300         _tmpKey = _stmt.getLong(_itemKeyIndex)
301         val _tmpRelation: MutableList<Song>? = _map.get(_tmpKey)
302         if (_tmpRelation != null) {
303           val _item_1: Song
304           val _tmpSongId: Long
305           _tmpSongId = _stmt.getLong(_columnIndexOfSongId)
306           val _tmpArtistKey: Long?
307           if (_stmt.isNull(_columnIndexOfArtistKey)) {
308             _tmpArtistKey = null
309           } else {
310             _tmpArtistKey = _stmt.getLong(_columnIndexOfArtistKey)
311           }
312           _item_1 = Song(_tmpSongId,_tmpArtistKey)
313           _tmpRelation.add(_item_1)
314         }
315       }
316     } finally {
317       _stmt.close()
318     }
319   }
320 
321   public companion object {
322     public fun getRequiredConverters(): List<KClass<*>> = emptyList()
323   }
324 }
325