blob: b5ec3163b67c0f9a79b9280a85a672b7bb3541b7 [file] [log] [blame]
elifbilgin1f766542022-11-21 17:21:44 -08001import android.database.Cursor
2import android.os.CancellationSignal
3import androidx.room.EntityDeletionOrUpdateAdapter
4import androidx.room.EntityInsertionAdapter
5import androidx.room.EntityUpsertionAdapter
6import androidx.room.RoomDatabase
7import androidx.room.RoomSQLiteQuery
8import androidx.room.RoomSQLiteQuery.Companion.acquire
9import androidx.room.guava.GuavaRoom
10import androidx.room.util.appendPlaceholders
11import androidx.room.util.createCancellationSignal
12import androidx.room.util.getColumnIndexOrThrow
13import androidx.room.util.newStringBuilder
14import androidx.room.util.query
15import androidx.sqlite.db.SupportSQLiteStatement
16import com.google.common.util.concurrent.ListenableFuture
17import java.lang.Class
18import java.lang.StringBuilder
19import java.util.concurrent.Callable
20import javax.`annotation`.processing.Generated
21import kotlin.Int
22import kotlin.Long
23import kotlin.String
24import kotlin.Suppress
elifbilgin1f766542022-11-21 17:21:44 -080025import kotlin.collections.List
26import kotlin.jvm.JvmStatic
27
28@Generated(value = ["androidx.room.RoomProcessor"])
elifbilgind46e8c12023-01-17 09:32:11 -080029@Suppress(names = ["UNCHECKED_CAST", "DEPRECATION", "REDUNDANT_PROJECTION"])
elifbilgin1f766542022-11-21 17:21:44 -080030public class MyDao_Impl(
31 __db: RoomDatabase,
32) : MyDao {
33 private val __db: RoomDatabase
34
35 private val __insertionAdapterOfMyEntity: EntityInsertionAdapter<MyEntity>
36
37 private val __deletionAdapterOfMyEntity: EntityDeletionOrUpdateAdapter<MyEntity>
38
39 private val __updateAdapterOfMyEntity: EntityDeletionOrUpdateAdapter<MyEntity>
40
41 private val __upsertionAdapterOfMyEntity: EntityUpsertionAdapter<MyEntity>
42 init {
43 this.__db = __db
44 this.__insertionAdapterOfMyEntity = object : EntityInsertionAdapter<MyEntity>(__db) {
45 public override fun createQuery(): String =
46 "INSERT OR ABORT INTO `MyEntity` (`pk`,`other`) VALUES (?,?)"
47
Daniel Santiago Riveraa6dec5a2023-05-02 15:09:07 -040048 public override fun bind(statement: SupportSQLiteStatement, entity: MyEntity) {
elifbilgin1f766542022-11-21 17:21:44 -080049 statement.bindLong(1, entity.pk.toLong())
50 statement.bindString(2, entity.other)
51 }
52 }
53 this.__deletionAdapterOfMyEntity = object : EntityDeletionOrUpdateAdapter<MyEntity>(__db) {
54 public override fun createQuery(): String = "DELETE FROM `MyEntity` WHERE `pk` = ?"
55
Daniel Santiago Riveraa6dec5a2023-05-02 15:09:07 -040056 public override fun bind(statement: SupportSQLiteStatement, entity: MyEntity) {
elifbilgin1f766542022-11-21 17:21:44 -080057 statement.bindLong(1, entity.pk.toLong())
58 }
59 }
60 this.__updateAdapterOfMyEntity = object : EntityDeletionOrUpdateAdapter<MyEntity>(__db) {
61 public override fun createQuery(): String =
62 "UPDATE OR ABORT `MyEntity` SET `pk` = ?,`other` = ? WHERE `pk` = ?"
63
Daniel Santiago Riveraa6dec5a2023-05-02 15:09:07 -040064 public override fun bind(statement: SupportSQLiteStatement, entity: MyEntity) {
elifbilgin1f766542022-11-21 17:21:44 -080065 statement.bindLong(1, entity.pk.toLong())
66 statement.bindString(2, entity.other)
67 statement.bindLong(3, entity.pk.toLong())
68 }
69 }
70 this.__upsertionAdapterOfMyEntity = EntityUpsertionAdapter<MyEntity>(object :
71 EntityInsertionAdapter<MyEntity>(__db) {
72 public override fun createQuery(): String =
73 "INSERT INTO `MyEntity` (`pk`,`other`) VALUES (?,?)"
74
Daniel Santiago Riveraa6dec5a2023-05-02 15:09:07 -040075 public override fun bind(statement: SupportSQLiteStatement, entity: MyEntity) {
elifbilgin1f766542022-11-21 17:21:44 -080076 statement.bindLong(1, entity.pk.toLong())
77 statement.bindString(2, entity.other)
78 }
79 }, object : EntityDeletionOrUpdateAdapter<MyEntity>(__db) {
80 public override fun createQuery(): String =
81 "UPDATE `MyEntity` SET `pk` = ?,`other` = ? WHERE `pk` = ?"
82
Daniel Santiago Riveraa6dec5a2023-05-02 15:09:07 -040083 public override fun bind(statement: SupportSQLiteStatement, entity: MyEntity) {
elifbilgin1f766542022-11-21 17:21:44 -080084 statement.bindLong(1, entity.pk.toLong())
85 statement.bindString(2, entity.other)
86 statement.bindLong(3, entity.pk.toLong())
87 }
88 })
89 }
90
91 public override fun insertListenableFuture(vararg entities: MyEntity):
92 ListenableFuture<List<Long>> = GuavaRoom.createListenableFuture(__db, true, object :
93 Callable<List<Long>> {
94 public override fun call(): List<Long> {
95 __db.beginTransaction()
96 try {
97 val _result: List<Long> = __insertionAdapterOfMyEntity.insertAndReturnIdsList(entities)
98 __db.setTransactionSuccessful()
99 return _result
100 } finally {
101 __db.endTransaction()
102 }
103 }
104 })
105
106 public override fun deleteListenableFuture(entity: MyEntity): ListenableFuture<Int> =
107 GuavaRoom.createListenableFuture(__db, true, object : Callable<Int> {
108 public override fun call(): Int {
109 var _total: Int = 0
110 __db.beginTransaction()
111 try {
112 _total += __deletionAdapterOfMyEntity.handle(entity)
113 __db.setTransactionSuccessful()
114 return _total
115 } finally {
116 __db.endTransaction()
117 }
118 }
119 })
120
121 public override fun updateListenableFuture(entity: MyEntity): ListenableFuture<Int> =
122 GuavaRoom.createListenableFuture(__db, true, object : Callable<Int> {
123 public override fun call(): Int {
124 var _total: Int = 0
125 __db.beginTransaction()
126 try {
127 _total += __updateAdapterOfMyEntity.handle(entity)
128 __db.setTransactionSuccessful()
129 return _total
130 } finally {
131 __db.endTransaction()
132 }
133 }
134 })
135
136 public override fun upsertListenableFuture(vararg entities: MyEntity):
137 ListenableFuture<List<Long>> = GuavaRoom.createListenableFuture(__db, true, object :
138 Callable<List<Long>> {
139 public override fun call(): List<Long> {
140 __db.beginTransaction()
141 try {
142 val _result: List<Long> = __upsertionAdapterOfMyEntity.upsertAndReturnIdsList(entities)
143 __db.setTransactionSuccessful()
144 return _result
145 } finally {
146 __db.endTransaction()
147 }
148 }
149 })
150
151 public override fun getListenableFuture(vararg arg: String?): ListenableFuture<MyEntity> {
152 val _stringBuilder: StringBuilder = newStringBuilder()
153 _stringBuilder.append("SELECT * FROM MyEntity WHERE pk IN (")
154 val _inputSize: Int = arg.size
155 appendPlaceholders(_stringBuilder, _inputSize)
156 _stringBuilder.append(")")
157 val _sql: String = _stringBuilder.toString()
158 val _argCount: Int = 0 + _inputSize
159 val _statement: RoomSQLiteQuery = acquire(_sql, _argCount)
160 var _argIndex: Int = 1
161 for (_item: String? in arg) {
162 if (_item == null) {
163 _statement.bindNull(_argIndex)
164 } else {
165 _statement.bindString(_argIndex, _item)
166 }
167 _argIndex++
168 }
169 val _cancellationSignal: CancellationSignal? = createCancellationSignal()
170 return GuavaRoom.createListenableFuture(__db, false, object : Callable<MyEntity> {
171 public override fun call(): MyEntity {
172 val _cursor: Cursor = query(__db, _statement, false, _cancellationSignal)
173 try {
174 val _cursorIndexOfPk: Int = getColumnIndexOrThrow(_cursor, "pk")
175 val _cursorIndexOfOther: Int = getColumnIndexOrThrow(_cursor, "other")
176 val _result: MyEntity
177 if (_cursor.moveToFirst()) {
178 val _tmpPk: Int
179 _tmpPk = _cursor.getInt(_cursorIndexOfPk)
180 val _tmpOther: String
181 _tmpOther = _cursor.getString(_cursorIndexOfOther)
182 _result = MyEntity(_tmpPk,_tmpOther)
183 } else {
elifbilgin22935ce2023-07-25 14:14:10 -0700184 error("The query result was empty, but expected a single row to return a NON-NULL object of type <MyEntity>.")
elifbilgin1f766542022-11-21 17:21:44 -0800185 }
186 return _result
187 } finally {
188 _cursor.close()
189 }
190 }
191 }, _statement, true, _cancellationSignal)
192 }
193
194 public override fun getListenableFutureNullable(vararg arg: String?):
195 ListenableFuture<MyEntity?> {
196 val _stringBuilder: StringBuilder = newStringBuilder()
197 _stringBuilder.append("SELECT * FROM MyEntity WHERE pk IN (")
198 val _inputSize: Int = arg.size
199 appendPlaceholders(_stringBuilder, _inputSize)
200 _stringBuilder.append(")")
201 val _sql: String = _stringBuilder.toString()
202 val _argCount: Int = 0 + _inputSize
203 val _statement: RoomSQLiteQuery = acquire(_sql, _argCount)
204 var _argIndex: Int = 1
205 for (_item: String? in arg) {
206 if (_item == null) {
207 _statement.bindNull(_argIndex)
208 } else {
209 _statement.bindString(_argIndex, _item)
210 }
211 _argIndex++
212 }
213 val _cancellationSignal: CancellationSignal? = createCancellationSignal()
214 return GuavaRoom.createListenableFuture(__db, false, object : Callable<MyEntity?> {
215 public override fun call(): MyEntity? {
216 val _cursor: Cursor = query(__db, _statement, false, _cancellationSignal)
217 try {
218 val _cursorIndexOfPk: Int = getColumnIndexOrThrow(_cursor, "pk")
219 val _cursorIndexOfOther: Int = getColumnIndexOrThrow(_cursor, "other")
220 val _result: MyEntity?
221 if (_cursor.moveToFirst()) {
222 val _tmpPk: Int
223 _tmpPk = _cursor.getInt(_cursorIndexOfPk)
224 val _tmpOther: String
225 _tmpOther = _cursor.getString(_cursorIndexOfOther)
226 _result = MyEntity(_tmpPk,_tmpOther)
227 } else {
228 _result = null
229 }
230 return _result
231 } finally {
232 _cursor.close()
233 }
234 }
235 }, _statement, true, _cancellationSignal)
236 }
237
238 public companion object {
239 @JvmStatic
240 public fun getRequiredConverters(): List<Class<*>> = emptyList()
241 }
242}