elifbilgin | 1f76654 | 2022-11-21 17:21:44 -0800 | [diff] [blame] | 1 | import android.database.Cursor |
| 2 | import androidx.room.EmptyResultSetException |
| 3 | import androidx.room.RoomDatabase |
| 4 | import androidx.room.RoomSQLiteQuery |
| 5 | import androidx.room.RoomSQLiteQuery.Companion.acquire |
| 6 | import androidx.room.RxRoom |
| 7 | import androidx.room.util.appendPlaceholders |
| 8 | import androidx.room.util.getColumnIndexOrThrow |
| 9 | import androidx.room.util.newStringBuilder |
| 10 | import androidx.room.util.query |
| 11 | import io.reactivex.Flowable |
| 12 | import io.reactivex.Maybe |
| 13 | import io.reactivex.Observable |
| 14 | import io.reactivex.Single |
| 15 | import java.lang.Class |
| 16 | import java.lang.StringBuilder |
| 17 | import java.util.concurrent.Callable |
| 18 | import javax.`annotation`.processing.Generated |
| 19 | import kotlin.Int |
| 20 | import kotlin.String |
| 21 | import kotlin.Suppress |
elifbilgin | 1f76654 | 2022-11-21 17:21:44 -0800 | [diff] [blame] | 22 | import kotlin.collections.List |
| 23 | import kotlin.jvm.JvmStatic |
| 24 | |
| 25 | @Generated(value = ["androidx.room.RoomProcessor"]) |
elifbilgin | d46e8c1 | 2023-01-17 09:32:11 -0800 | [diff] [blame] | 26 | @Suppress(names = ["UNCHECKED_CAST", "DEPRECATION", "REDUNDANT_PROJECTION"]) |
elifbilgin | 1f76654 | 2022-11-21 17:21:44 -0800 | [diff] [blame] | 27 | public class MyDao_Impl( |
| 28 | __db: RoomDatabase, |
| 29 | ) : MyDao { |
| 30 | private val __db: RoomDatabase |
| 31 | init { |
| 32 | this.__db = __db |
| 33 | } |
| 34 | |
| 35 | public override fun getFlowable(vararg arg: String?): Flowable<MyEntity> { |
| 36 | val _stringBuilder: StringBuilder = newStringBuilder() |
| 37 | _stringBuilder.append("SELECT * FROM MyEntity WHERE pk IN (") |
| 38 | val _inputSize: Int = arg.size |
| 39 | appendPlaceholders(_stringBuilder, _inputSize) |
| 40 | _stringBuilder.append(")") |
| 41 | val _sql: String = _stringBuilder.toString() |
| 42 | val _argCount: Int = 0 + _inputSize |
| 43 | val _statement: RoomSQLiteQuery = acquire(_sql, _argCount) |
| 44 | var _argIndex: Int = 1 |
| 45 | for (_item: String? in arg) { |
| 46 | if (_item == null) { |
| 47 | _statement.bindNull(_argIndex) |
| 48 | } else { |
| 49 | _statement.bindString(_argIndex, _item) |
| 50 | } |
| 51 | _argIndex++ |
| 52 | } |
| 53 | return RxRoom.createFlowable(__db, false, arrayOf("MyEntity"), object : Callable<MyEntity> { |
| 54 | public override fun call(): MyEntity { |
| 55 | val _cursor: Cursor = query(__db, _statement, false, null) |
| 56 | try { |
| 57 | val _cursorIndexOfPk: Int = getColumnIndexOrThrow(_cursor, "pk") |
| 58 | val _cursorIndexOfOther: Int = getColumnIndexOrThrow(_cursor, "other") |
| 59 | val _result: MyEntity |
| 60 | if (_cursor.moveToFirst()) { |
| 61 | val _tmpPk: Int |
| 62 | _tmpPk = _cursor.getInt(_cursorIndexOfPk) |
| 63 | val _tmpOther: String |
| 64 | _tmpOther = _cursor.getString(_cursorIndexOfOther) |
| 65 | _result = MyEntity(_tmpPk,_tmpOther) |
| 66 | } else { |
elifbilgin | 22935ce | 2023-07-25 14:14:10 -0700 | [diff] [blame^] | 67 | error("The query result was empty, but expected a single row to return a NON-NULL object of type <MyEntity>.") |
elifbilgin | 1f76654 | 2022-11-21 17:21:44 -0800 | [diff] [blame] | 68 | } |
| 69 | return _result |
| 70 | } finally { |
| 71 | _cursor.close() |
| 72 | } |
| 73 | } |
| 74 | |
Daniel Santiago Rivera | a6dec5a | 2023-05-02 15:09:07 -0400 | [diff] [blame] | 75 | protected fun finalize() { |
elifbilgin | 1f76654 | 2022-11-21 17:21:44 -0800 | [diff] [blame] | 76 | _statement.release() |
| 77 | } |
| 78 | }) |
| 79 | } |
| 80 | |
| 81 | public override fun getObservable(vararg arg: String?): Observable<MyEntity> { |
| 82 | val _stringBuilder: StringBuilder = newStringBuilder() |
| 83 | _stringBuilder.append("SELECT * FROM MyEntity WHERE pk IN (") |
| 84 | val _inputSize: Int = arg.size |
| 85 | appendPlaceholders(_stringBuilder, _inputSize) |
| 86 | _stringBuilder.append(")") |
| 87 | val _sql: String = _stringBuilder.toString() |
| 88 | val _argCount: Int = 0 + _inputSize |
| 89 | val _statement: RoomSQLiteQuery = acquire(_sql, _argCount) |
| 90 | var _argIndex: Int = 1 |
| 91 | for (_item: String? in arg) { |
| 92 | if (_item == null) { |
| 93 | _statement.bindNull(_argIndex) |
| 94 | } else { |
| 95 | _statement.bindString(_argIndex, _item) |
| 96 | } |
| 97 | _argIndex++ |
| 98 | } |
| 99 | return RxRoom.createObservable(__db, false, arrayOf("MyEntity"), object : Callable<MyEntity> { |
| 100 | public override fun call(): MyEntity { |
| 101 | val _cursor: Cursor = query(__db, _statement, false, null) |
| 102 | try { |
| 103 | val _cursorIndexOfPk: Int = getColumnIndexOrThrow(_cursor, "pk") |
| 104 | val _cursorIndexOfOther: Int = getColumnIndexOrThrow(_cursor, "other") |
| 105 | val _result: MyEntity |
| 106 | if (_cursor.moveToFirst()) { |
| 107 | val _tmpPk: Int |
| 108 | _tmpPk = _cursor.getInt(_cursorIndexOfPk) |
| 109 | val _tmpOther: String |
| 110 | _tmpOther = _cursor.getString(_cursorIndexOfOther) |
| 111 | _result = MyEntity(_tmpPk,_tmpOther) |
| 112 | } else { |
elifbilgin | 22935ce | 2023-07-25 14:14:10 -0700 | [diff] [blame^] | 113 | error("The query result was empty, but expected a single row to return a NON-NULL object of type <MyEntity>.") |
elifbilgin | 1f76654 | 2022-11-21 17:21:44 -0800 | [diff] [blame] | 114 | } |
| 115 | return _result |
| 116 | } finally { |
| 117 | _cursor.close() |
| 118 | } |
| 119 | } |
| 120 | |
Daniel Santiago Rivera | a6dec5a | 2023-05-02 15:09:07 -0400 | [diff] [blame] | 121 | protected fun finalize() { |
elifbilgin | 1f76654 | 2022-11-21 17:21:44 -0800 | [diff] [blame] | 122 | _statement.release() |
| 123 | } |
| 124 | }) |
| 125 | } |
| 126 | |
| 127 | public override fun getSingle(vararg arg: String?): Single<MyEntity> { |
| 128 | val _stringBuilder: StringBuilder = newStringBuilder() |
| 129 | _stringBuilder.append("SELECT * FROM MyEntity WHERE pk IN (") |
| 130 | val _inputSize: Int = arg.size |
| 131 | appendPlaceholders(_stringBuilder, _inputSize) |
| 132 | _stringBuilder.append(")") |
| 133 | val _sql: String = _stringBuilder.toString() |
| 134 | val _argCount: Int = 0 + _inputSize |
| 135 | val _statement: RoomSQLiteQuery = acquire(_sql, _argCount) |
| 136 | var _argIndex: Int = 1 |
| 137 | for (_item: String? in arg) { |
| 138 | if (_item == null) { |
| 139 | _statement.bindNull(_argIndex) |
| 140 | } else { |
| 141 | _statement.bindString(_argIndex, _item) |
| 142 | } |
| 143 | _argIndex++ |
| 144 | } |
elifbilgin | d46e8c1 | 2023-01-17 09:32:11 -0800 | [diff] [blame] | 145 | return RxRoom.createSingle(object : Callable<MyEntity?> { |
| 146 | public override fun call(): MyEntity? { |
elifbilgin | 1f76654 | 2022-11-21 17:21:44 -0800 | [diff] [blame] | 147 | val _cursor: Cursor = query(__db, _statement, false, null) |
| 148 | try { |
| 149 | val _cursorIndexOfPk: Int = getColumnIndexOrThrow(_cursor, "pk") |
| 150 | val _cursorIndexOfOther: Int = getColumnIndexOrThrow(_cursor, "other") |
elifbilgin | d46e8c1 | 2023-01-17 09:32:11 -0800 | [diff] [blame] | 151 | val _result: MyEntity? |
elifbilgin | 1f76654 | 2022-11-21 17:21:44 -0800 | [diff] [blame] | 152 | if (_cursor.moveToFirst()) { |
| 153 | val _tmpPk: Int |
| 154 | _tmpPk = _cursor.getInt(_cursorIndexOfPk) |
| 155 | val _tmpOther: String |
| 156 | _tmpOther = _cursor.getString(_cursorIndexOfOther) |
| 157 | _result = MyEntity(_tmpPk,_tmpOther) |
| 158 | } else { |
elifbilgin | d46e8c1 | 2023-01-17 09:32:11 -0800 | [diff] [blame] | 159 | _result = null |
| 160 | } |
| 161 | if (_result == null) { |
| 162 | throw EmptyResultSetException("Query returned empty result set: " + _statement.sql) |
elifbilgin | 1f76654 | 2022-11-21 17:21:44 -0800 | [diff] [blame] | 163 | } |
| 164 | return _result |
| 165 | } finally { |
| 166 | _cursor.close() |
| 167 | } |
| 168 | } |
| 169 | |
Daniel Santiago Rivera | a6dec5a | 2023-05-02 15:09:07 -0400 | [diff] [blame] | 170 | protected fun finalize() { |
elifbilgin | 1f76654 | 2022-11-21 17:21:44 -0800 | [diff] [blame] | 171 | _statement.release() |
| 172 | } |
| 173 | }) |
| 174 | } |
| 175 | |
| 176 | public override fun getMaybe(vararg arg: String?): Maybe<MyEntity> { |
| 177 | val _stringBuilder: StringBuilder = newStringBuilder() |
| 178 | _stringBuilder.append("SELECT * FROM MyEntity WHERE pk IN (") |
| 179 | val _inputSize: Int = arg.size |
| 180 | appendPlaceholders(_stringBuilder, _inputSize) |
| 181 | _stringBuilder.append(")") |
| 182 | val _sql: String = _stringBuilder.toString() |
| 183 | val _argCount: Int = 0 + _inputSize |
| 184 | val _statement: RoomSQLiteQuery = acquire(_sql, _argCount) |
| 185 | var _argIndex: Int = 1 |
| 186 | for (_item: String? in arg) { |
| 187 | if (_item == null) { |
| 188 | _statement.bindNull(_argIndex) |
| 189 | } else { |
| 190 | _statement.bindString(_argIndex, _item) |
| 191 | } |
| 192 | _argIndex++ |
| 193 | } |
elifbilgin | d46e8c1 | 2023-01-17 09:32:11 -0800 | [diff] [blame] | 194 | return Maybe.fromCallable(object : Callable<MyEntity?> { |
| 195 | public override fun call(): MyEntity? { |
elifbilgin | 1f76654 | 2022-11-21 17:21:44 -0800 | [diff] [blame] | 196 | val _cursor: Cursor = query(__db, _statement, false, null) |
| 197 | try { |
| 198 | val _cursorIndexOfPk: Int = getColumnIndexOrThrow(_cursor, "pk") |
| 199 | val _cursorIndexOfOther: Int = getColumnIndexOrThrow(_cursor, "other") |
elifbilgin | d46e8c1 | 2023-01-17 09:32:11 -0800 | [diff] [blame] | 200 | val _result: MyEntity? |
elifbilgin | 1f76654 | 2022-11-21 17:21:44 -0800 | [diff] [blame] | 201 | if (_cursor.moveToFirst()) { |
| 202 | val _tmpPk: Int |
| 203 | _tmpPk = _cursor.getInt(_cursorIndexOfPk) |
| 204 | val _tmpOther: String |
| 205 | _tmpOther = _cursor.getString(_cursorIndexOfOther) |
| 206 | _result = MyEntity(_tmpPk,_tmpOther) |
| 207 | } else { |
elifbilgin | d46e8c1 | 2023-01-17 09:32:11 -0800 | [diff] [blame] | 208 | _result = null |
elifbilgin | 1f76654 | 2022-11-21 17:21:44 -0800 | [diff] [blame] | 209 | } |
| 210 | return _result |
| 211 | } finally { |
| 212 | _cursor.close() |
| 213 | } |
| 214 | } |
| 215 | |
Daniel Santiago Rivera | a6dec5a | 2023-05-02 15:09:07 -0400 | [diff] [blame] | 216 | protected fun finalize() { |
elifbilgin | 1f76654 | 2022-11-21 17:21:44 -0800 | [diff] [blame] | 217 | _statement.release() |
| 218 | } |
| 219 | }) |
| 220 | } |
| 221 | |
| 222 | public override fun getFlowableNullable(vararg arg: String?): Flowable<MyEntity?> { |
| 223 | val _stringBuilder: StringBuilder = newStringBuilder() |
| 224 | _stringBuilder.append("SELECT * FROM MyEntity WHERE pk IN (") |
| 225 | val _inputSize: Int = arg.size |
| 226 | appendPlaceholders(_stringBuilder, _inputSize) |
| 227 | _stringBuilder.append(")") |
| 228 | val _sql: String = _stringBuilder.toString() |
| 229 | val _argCount: Int = 0 + _inputSize |
| 230 | val _statement: RoomSQLiteQuery = acquire(_sql, _argCount) |
| 231 | var _argIndex: Int = 1 |
| 232 | for (_item: String? in arg) { |
| 233 | if (_item == null) { |
| 234 | _statement.bindNull(_argIndex) |
| 235 | } else { |
| 236 | _statement.bindString(_argIndex, _item) |
| 237 | } |
| 238 | _argIndex++ |
| 239 | } |
| 240 | return RxRoom.createFlowable(__db, false, arrayOf("MyEntity"), object : Callable<MyEntity?> { |
| 241 | public override fun call(): MyEntity? { |
| 242 | val _cursor: Cursor = query(__db, _statement, false, null) |
| 243 | try { |
| 244 | val _cursorIndexOfPk: Int = getColumnIndexOrThrow(_cursor, "pk") |
| 245 | val _cursorIndexOfOther: Int = getColumnIndexOrThrow(_cursor, "other") |
| 246 | val _result: MyEntity? |
| 247 | if (_cursor.moveToFirst()) { |
| 248 | val _tmpPk: Int |
| 249 | _tmpPk = _cursor.getInt(_cursorIndexOfPk) |
| 250 | val _tmpOther: String |
| 251 | _tmpOther = _cursor.getString(_cursorIndexOfOther) |
| 252 | _result = MyEntity(_tmpPk,_tmpOther) |
| 253 | } else { |
| 254 | _result = null |
| 255 | } |
| 256 | return _result |
| 257 | } finally { |
| 258 | _cursor.close() |
| 259 | } |
| 260 | } |
| 261 | |
Daniel Santiago Rivera | a6dec5a | 2023-05-02 15:09:07 -0400 | [diff] [blame] | 262 | protected fun finalize() { |
elifbilgin | 1f76654 | 2022-11-21 17:21:44 -0800 | [diff] [blame] | 263 | _statement.release() |
| 264 | } |
| 265 | }) |
| 266 | } |
| 267 | |
| 268 | public override fun getObservableNullable(vararg arg: String?): Observable<MyEntity?> { |
| 269 | val _stringBuilder: StringBuilder = newStringBuilder() |
| 270 | _stringBuilder.append("SELECT * FROM MyEntity WHERE pk IN (") |
| 271 | val _inputSize: Int = arg.size |
| 272 | appendPlaceholders(_stringBuilder, _inputSize) |
| 273 | _stringBuilder.append(")") |
| 274 | val _sql: String = _stringBuilder.toString() |
| 275 | val _argCount: Int = 0 + _inputSize |
| 276 | val _statement: RoomSQLiteQuery = acquire(_sql, _argCount) |
| 277 | var _argIndex: Int = 1 |
| 278 | for (_item: String? in arg) { |
| 279 | if (_item == null) { |
| 280 | _statement.bindNull(_argIndex) |
| 281 | } else { |
| 282 | _statement.bindString(_argIndex, _item) |
| 283 | } |
| 284 | _argIndex++ |
| 285 | } |
| 286 | return RxRoom.createObservable(__db, false, arrayOf("MyEntity"), object : Callable<MyEntity?> { |
| 287 | public override fun call(): MyEntity? { |
| 288 | val _cursor: Cursor = query(__db, _statement, false, null) |
| 289 | try { |
| 290 | val _cursorIndexOfPk: Int = getColumnIndexOrThrow(_cursor, "pk") |
| 291 | val _cursorIndexOfOther: Int = getColumnIndexOrThrow(_cursor, "other") |
| 292 | val _result: MyEntity? |
| 293 | if (_cursor.moveToFirst()) { |
| 294 | val _tmpPk: Int |
| 295 | _tmpPk = _cursor.getInt(_cursorIndexOfPk) |
| 296 | val _tmpOther: String |
| 297 | _tmpOther = _cursor.getString(_cursorIndexOfOther) |
| 298 | _result = MyEntity(_tmpPk,_tmpOther) |
| 299 | } else { |
| 300 | _result = null |
| 301 | } |
| 302 | return _result |
| 303 | } finally { |
| 304 | _cursor.close() |
| 305 | } |
| 306 | } |
| 307 | |
Daniel Santiago Rivera | a6dec5a | 2023-05-02 15:09:07 -0400 | [diff] [blame] | 308 | protected fun finalize() { |
elifbilgin | 1f76654 | 2022-11-21 17:21:44 -0800 | [diff] [blame] | 309 | _statement.release() |
| 310 | } |
| 311 | }) |
| 312 | } |
| 313 | |
| 314 | public override fun getSingleNullable(vararg arg: String?): Single<MyEntity?> { |
| 315 | val _stringBuilder: StringBuilder = newStringBuilder() |
| 316 | _stringBuilder.append("SELECT * FROM MyEntity WHERE pk IN (") |
| 317 | val _inputSize: Int = arg.size |
| 318 | appendPlaceholders(_stringBuilder, _inputSize) |
| 319 | _stringBuilder.append(")") |
| 320 | val _sql: String = _stringBuilder.toString() |
| 321 | val _argCount: Int = 0 + _inputSize |
| 322 | val _statement: RoomSQLiteQuery = acquire(_sql, _argCount) |
| 323 | var _argIndex: Int = 1 |
| 324 | for (_item: String? in arg) { |
| 325 | if (_item == null) { |
| 326 | _statement.bindNull(_argIndex) |
| 327 | } else { |
| 328 | _statement.bindString(_argIndex, _item) |
| 329 | } |
| 330 | _argIndex++ |
| 331 | } |
| 332 | return RxRoom.createSingle(object : Callable<MyEntity?> { |
| 333 | public override fun call(): MyEntity? { |
| 334 | val _cursor: Cursor = query(__db, _statement, false, null) |
| 335 | try { |
| 336 | val _cursorIndexOfPk: Int = getColumnIndexOrThrow(_cursor, "pk") |
| 337 | val _cursorIndexOfOther: Int = getColumnIndexOrThrow(_cursor, "other") |
| 338 | val _result: MyEntity? |
| 339 | if (_cursor.moveToFirst()) { |
| 340 | val _tmpPk: Int |
| 341 | _tmpPk = _cursor.getInt(_cursorIndexOfPk) |
| 342 | val _tmpOther: String |
| 343 | _tmpOther = _cursor.getString(_cursorIndexOfOther) |
| 344 | _result = MyEntity(_tmpPk,_tmpOther) |
| 345 | } else { |
| 346 | _result = null |
| 347 | } |
| 348 | if (_result == null) { |
| 349 | throw EmptyResultSetException("Query returned empty result set: " + _statement.sql) |
| 350 | } |
| 351 | return _result |
| 352 | } finally { |
| 353 | _cursor.close() |
| 354 | } |
| 355 | } |
| 356 | |
Daniel Santiago Rivera | a6dec5a | 2023-05-02 15:09:07 -0400 | [diff] [blame] | 357 | protected fun finalize() { |
elifbilgin | 1f76654 | 2022-11-21 17:21:44 -0800 | [diff] [blame] | 358 | _statement.release() |
| 359 | } |
| 360 | }) |
| 361 | } |
| 362 | |
| 363 | public override fun getMaybeNullable(vararg arg: String?): Maybe<MyEntity?> { |
| 364 | val _stringBuilder: StringBuilder = newStringBuilder() |
| 365 | _stringBuilder.append("SELECT * FROM MyEntity WHERE pk IN (") |
| 366 | val _inputSize: Int = arg.size |
| 367 | appendPlaceholders(_stringBuilder, _inputSize) |
| 368 | _stringBuilder.append(")") |
| 369 | val _sql: String = _stringBuilder.toString() |
| 370 | val _argCount: Int = 0 + _inputSize |
| 371 | val _statement: RoomSQLiteQuery = acquire(_sql, _argCount) |
| 372 | var _argIndex: Int = 1 |
| 373 | for (_item: String? in arg) { |
| 374 | if (_item == null) { |
| 375 | _statement.bindNull(_argIndex) |
| 376 | } else { |
| 377 | _statement.bindString(_argIndex, _item) |
| 378 | } |
| 379 | _argIndex++ |
| 380 | } |
| 381 | return Maybe.fromCallable(object : Callable<MyEntity?> { |
| 382 | public override fun call(): MyEntity? { |
| 383 | val _cursor: Cursor = query(__db, _statement, false, null) |
| 384 | try { |
| 385 | val _cursorIndexOfPk: Int = getColumnIndexOrThrow(_cursor, "pk") |
| 386 | val _cursorIndexOfOther: Int = getColumnIndexOrThrow(_cursor, "other") |
| 387 | val _result: MyEntity? |
| 388 | if (_cursor.moveToFirst()) { |
| 389 | val _tmpPk: Int |
| 390 | _tmpPk = _cursor.getInt(_cursorIndexOfPk) |
| 391 | val _tmpOther: String |
| 392 | _tmpOther = _cursor.getString(_cursorIndexOfOther) |
| 393 | _result = MyEntity(_tmpPk,_tmpOther) |
| 394 | } else { |
| 395 | _result = null |
| 396 | } |
elifbilgin | 1f76654 | 2022-11-21 17:21:44 -0800 | [diff] [blame] | 397 | return _result |
| 398 | } finally { |
| 399 | _cursor.close() |
| 400 | } |
| 401 | } |
| 402 | |
Daniel Santiago Rivera | a6dec5a | 2023-05-02 15:09:07 -0400 | [diff] [blame] | 403 | protected fun finalize() { |
elifbilgin | 1f76654 | 2022-11-21 17:21:44 -0800 | [diff] [blame] | 404 | _statement.release() |
| 405 | } |
| 406 | }) |
| 407 | } |
| 408 | |
| 409 | public companion object { |
| 410 | @JvmStatic |
| 411 | public fun getRequiredConverters(): List<Class<*>> = emptyList() |
| 412 | } |
| 413 | } |