<lambda>null1 import androidx.room.EntityDeleteOrUpdateAdapter
2 import androidx.room.EntityInsertAdapter
3 import androidx.room.EntityUpsertAdapter
4 import androidx.room.RoomDatabase
5 import androidx.room.guava.createListenableFuture
6 import androidx.room.util.appendPlaceholders
7 import androidx.room.util.getColumnIndexOrThrow
8 import androidx.room.util.getLastInsertedRowId
9 import androidx.sqlite.SQLiteStatement
10 import com.google.common.util.concurrent.ListenableFuture
11 import java.lang.Void
12 import javax.`annotation`.processing.Generated
13 import kotlin.Int
14 import kotlin.Long
15 import kotlin.String
16 import kotlin.Suppress
17 import kotlin.collections.List
18 import kotlin.reflect.KClass
19 import kotlin.text.StringBuilder
20 
21 @Generated(value = ["androidx.room.RoomProcessor"])
22 @Suppress(names = ["UNCHECKED_CAST", "DEPRECATION", "REDUNDANT_PROJECTION", "REMOVAL"])
23 public class MyDao_Impl(
24   __db: RoomDatabase,
25 ) : MyDao {
26   private val __db: RoomDatabase
27 
28   private val __insertAdapterOfMyEntity: EntityInsertAdapter<MyEntity>
29 
30   private val __deleteAdapterOfMyEntity: EntityDeleteOrUpdateAdapter<MyEntity>
31 
32   private val __updateAdapterOfMyEntity: EntityDeleteOrUpdateAdapter<MyEntity>
33 
34   private val __upsertAdapterOfMyEntity: EntityUpsertAdapter<MyEntity>
35   init {
36     this.__db = __db
37     this.__insertAdapterOfMyEntity = object : EntityInsertAdapter<MyEntity>() {
38       protected override fun createQuery(): String = "INSERT OR ABORT INTO `MyEntity` (`pk`,`other`) VALUES (?,?)"
39 
40       protected override fun bind(statement: SQLiteStatement, entity: MyEntity) {
41         statement.bindLong(1, entity.pk.toLong())
42         statement.bindText(2, entity.other)
43       }
44     }
45     this.__deleteAdapterOfMyEntity = object : EntityDeleteOrUpdateAdapter<MyEntity>() {
46       protected override fun createQuery(): String = "DELETE FROM `MyEntity` WHERE `pk` = ?"
47 
48       protected override fun bind(statement: SQLiteStatement, entity: MyEntity) {
49         statement.bindLong(1, entity.pk.toLong())
50       }
51     }
52     this.__updateAdapterOfMyEntity = object : EntityDeleteOrUpdateAdapter<MyEntity>() {
53       protected override fun createQuery(): String = "UPDATE OR ABORT `MyEntity` SET `pk` = ?,`other` = ? WHERE `pk` = ?"
54 
55       protected override fun bind(statement: SQLiteStatement, entity: MyEntity) {
56         statement.bindLong(1, entity.pk.toLong())
57         statement.bindText(2, entity.other)
58         statement.bindLong(3, entity.pk.toLong())
59       }
60     }
61     this.__upsertAdapterOfMyEntity = EntityUpsertAdapter<MyEntity>(object : EntityInsertAdapter<MyEntity>() {
62       protected override fun createQuery(): String = "INSERT INTO `MyEntity` (`pk`,`other`) VALUES (?,?)"
63 
64       protected override fun bind(statement: SQLiteStatement, entity: MyEntity) {
65         statement.bindLong(1, entity.pk.toLong())
66         statement.bindText(2, entity.other)
67       }
68     }, object : EntityDeleteOrUpdateAdapter<MyEntity>() {
69       protected override fun createQuery(): String = "UPDATE `MyEntity` SET `pk` = ?,`other` = ? WHERE `pk` = ?"
70 
71       protected override fun bind(statement: SQLiteStatement, entity: MyEntity) {
72         statement.bindLong(1, entity.pk.toLong())
73         statement.bindText(2, entity.other)
74         statement.bindLong(3, entity.pk.toLong())
75       }
76     })
77   }
78 
79   public override fun insertListenableFuture(vararg entities: MyEntity): ListenableFuture<List<Long>> = createListenableFuture(__db, false, true) { _connection ->
80     val _result: List<Long> = __insertAdapterOfMyEntity.insertAndReturnIdsList(_connection, entities)
81     _result
82   }
83 
84   public override fun deleteListenableFuture(entity: MyEntity): ListenableFuture<Int> = createListenableFuture(__db, false, true) { _connection ->
85     var _result: Int = 0
86     _result += __deleteAdapterOfMyEntity.handle(_connection, entity)
87     _result
88   }
89 
90   public override fun updateListenableFuture(entity: MyEntity): ListenableFuture<Int> = createListenableFuture(__db, false, true) { _connection ->
91     var _result: Int = 0
92     _result += __updateAdapterOfMyEntity.handle(_connection, entity)
93     _result
94   }
95 
96   public override fun upsertListenableFuture(vararg entities: MyEntity): ListenableFuture<List<Long>> = createListenableFuture(__db, false, true) { _connection ->
97     val _result: List<Long> = __upsertAdapterOfMyEntity.upsertAndReturnIdsList(_connection, entities)
98     _result
99   }
100 
101   public override fun getListenableFuture(vararg arg: String?): ListenableFuture<MyEntity> {
102     val _stringBuilder: StringBuilder = StringBuilder()
103     _stringBuilder.append("SELECT * FROM MyEntity WHERE pk IN (")
104     val _inputSize: Int = arg.size
105     appendPlaceholders(_stringBuilder, _inputSize)
106     _stringBuilder.append(")")
107     val _sql: String = _stringBuilder.toString()
108     return createListenableFuture(__db, true, false) { _connection ->
109       val _stmt: SQLiteStatement = _connection.prepare(_sql)
110       try {
111         var _argIndex: Int = 1
112         for (_item: String? in arg) {
113           if (_item == null) {
114             _stmt.bindNull(_argIndex)
115           } else {
116             _stmt.bindText(_argIndex, _item)
117           }
118           _argIndex++
119         }
120         val _columnIndexOfPk: Int = getColumnIndexOrThrow(_stmt, "pk")
121         val _columnIndexOfOther: Int = getColumnIndexOrThrow(_stmt, "other")
122         val _result: MyEntity
123         if (_stmt.step()) {
124           val _tmpPk: Int
125           _tmpPk = _stmt.getLong(_columnIndexOfPk).toInt()
126           val _tmpOther: String
127           _tmpOther = _stmt.getText(_columnIndexOfOther)
128           _result = MyEntity(_tmpPk,_tmpOther)
129         } else {
130           error("The query result was empty, but expected a single row to return a NON-NULL object of type <MyEntity>.")
131         }
132         _result
133       } finally {
134         _stmt.close()
135       }
136     }
137   }
138 
139   public override fun getListenableFutureNullable(vararg arg: String?): ListenableFuture<MyEntity?> {
140     val _stringBuilder: StringBuilder = StringBuilder()
141     _stringBuilder.append("SELECT * FROM MyEntity WHERE pk IN (")
142     val _inputSize: Int = arg.size
143     appendPlaceholders(_stringBuilder, _inputSize)
144     _stringBuilder.append(")")
145     val _sql: String = _stringBuilder.toString()
146     return createListenableFuture(__db, true, false) { _connection ->
147       val _stmt: SQLiteStatement = _connection.prepare(_sql)
148       try {
149         var _argIndex: Int = 1
150         for (_item: String? in arg) {
151           if (_item == null) {
152             _stmt.bindNull(_argIndex)
153           } else {
154             _stmt.bindText(_argIndex, _item)
155           }
156           _argIndex++
157         }
158         val _columnIndexOfPk: Int = getColumnIndexOrThrow(_stmt, "pk")
159         val _columnIndexOfOther: Int = getColumnIndexOrThrow(_stmt, "other")
160         val _result: MyEntity?
161         if (_stmt.step()) {
162           val _tmpPk: Int
163           _tmpPk = _stmt.getLong(_columnIndexOfPk).toInt()
164           val _tmpOther: String
165           _tmpOther = _stmt.getText(_columnIndexOfOther)
166           _result = MyEntity(_tmpPk,_tmpOther)
167         } else {
168           _result = null
169         }
170         _result
171       } finally {
172         _stmt.close()
173       }
174     }
175   }
176 
177   public override fun insertListenableFuture(id: String, name: String): ListenableFuture<Long> {
178     val _sql: String = "INSERT INTO MyEntity (pk, other) VALUES (?, ?)"
179     return createListenableFuture(__db, false, true) { _connection ->
180       val _stmt: SQLiteStatement = _connection.prepare(_sql)
181       try {
182         var _argIndex: Int = 1
183         _stmt.bindText(_argIndex, id)
184         _argIndex = 2
185         _stmt.bindText(_argIndex, name)
186         _stmt.step()
187         getLastInsertedRowId(_connection)
188       } finally {
189         _stmt.close()
190       }
191     }
192   }
193 
194   public override fun updateListenableFuture(id: String, name: String): ListenableFuture<Void?> {
195     val _sql: String = "UPDATE MyEntity SET other = ? WHERE pk = ?"
196     return createListenableFuture(__db, false, true) { _connection ->
197       val _stmt: SQLiteStatement = _connection.prepare(_sql)
198       try {
199         var _argIndex: Int = 1
200         _stmt.bindText(_argIndex, name)
201         _argIndex = 2
202         _stmt.bindText(_argIndex, id)
203         _stmt.step()
204         null
205       } finally {
206         _stmt.close()
207       }
208     }
209   }
210 
211   public companion object {
212     public fun getRequiredConverters(): List<KClass<*>> = emptyList()
213   }
214 }
215