<lambda>null1 import androidx.room.EntityInsertAdapter
2 import androidx.room.RoomDatabase
3 import androidx.room.util.getColumnIndexOrThrow
4 import androidx.room.util.performBlocking
5 import androidx.sqlite.SQLiteStatement
6 import javax.`annotation`.processing.Generated
7 import kotlin.ByteArray
8 import kotlin.Int
9 import kotlin.String
10 import kotlin.Suppress
11 import kotlin.Unit
12 import kotlin.collections.List
13 import kotlin.reflect.KClass
14 
15 @Generated(value = ["androidx.room.RoomProcessor"])
16 @Suppress(names = ["UNCHECKED_CAST", "DEPRECATION", "REDUNDANT_PROJECTION", "REMOVAL"])
17 public class MyDao_Impl(
18   __db: RoomDatabase,
19 ) : MyDao {
20   private val __db: RoomDatabase
21 
22   private val __insertAdapterOfMyEntity: EntityInsertAdapter<MyEntity>
23   init {
24     this.__db = __db
25     this.__insertAdapterOfMyEntity = object : EntityInsertAdapter<MyEntity>() {
26       protected override fun createQuery(): String = "INSERT OR ABORT INTO `MyEntity` (`pk`,`byteArray`,`nullableByteArray`) VALUES (?,?,?)"
27 
28       protected override fun bind(statement: SQLiteStatement, entity: MyEntity) {
29         statement.bindLong(1, entity.pk.toLong())
30         statement.bindBlob(2, entity.byteArray)
31         val _tmpNullableByteArray: ByteArray? = entity.nullableByteArray
32         if (_tmpNullableByteArray == null) {
33           statement.bindNull(3)
34         } else {
35           statement.bindBlob(3, _tmpNullableByteArray)
36         }
37       }
38     }
39   }
40 
41   public override fun addEntity(item: MyEntity): Unit = performBlocking(__db, false, true) { _connection ->
42     __insertAdapterOfMyEntity.insert(_connection, item)
43   }
44 
45   public override fun getEntity(): MyEntity {
46     val _sql: String = "SELECT * FROM MyEntity"
47     return performBlocking(__db, true, false) { _connection ->
48       val _stmt: SQLiteStatement = _connection.prepare(_sql)
49       try {
50         val _columnIndexOfPk: Int = getColumnIndexOrThrow(_stmt, "pk")
51         val _columnIndexOfByteArray: Int = getColumnIndexOrThrow(_stmt, "byteArray")
52         val _columnIndexOfNullableByteArray: Int = getColumnIndexOrThrow(_stmt, "nullableByteArray")
53         val _result: MyEntity
54         if (_stmt.step()) {
55           val _tmpPk: Int
56           _tmpPk = _stmt.getLong(_columnIndexOfPk).toInt()
57           val _tmpByteArray: ByteArray
58           _tmpByteArray = _stmt.getBlob(_columnIndexOfByteArray)
59           val _tmpNullableByteArray: ByteArray?
60           if (_stmt.isNull(_columnIndexOfNullableByteArray)) {
61             _tmpNullableByteArray = null
62           } else {
63             _tmpNullableByteArray = _stmt.getBlob(_columnIndexOfNullableByteArray)
64           }
65           _result = MyEntity(_tmpPk,_tmpByteArray,_tmpNullableByteArray)
66         } else {
67           error("The query result was empty, but expected a single row to return a NON-NULL object of type <MyEntity>.")
68         }
69         _result
70       } finally {
71         _stmt.close()
72       }
73     }
74   }
75 
76   public companion object {
77     public fun getRequiredConverters(): List<KClass<*>> = emptyList()
78   }
79 }
80