Daniel Santiago Rivera | e695d18 | 2022-11-08 21:12:14 -0500 | [diff] [blame] | 1 | import android.database.Cursor |
| 2 | import androidx.room.EntityInsertionAdapter |
| 3 | import androidx.room.RoomDatabase |
| 4 | import androidx.room.RoomSQLiteQuery |
| 5 | import androidx.room.RoomSQLiteQuery.Companion.acquire |
| 6 | import androidx.room.util.getColumnIndexOrThrow |
| 7 | import androidx.room.util.query |
| 8 | import androidx.sqlite.db.SupportSQLiteStatement |
| 9 | import java.lang.Class |
| 10 | import javax.`annotation`.processing.Generated |
| 11 | import kotlin.Int |
| 12 | import kotlin.String |
| 13 | import kotlin.Suppress |
Daniel Santiago Rivera | e695d18 | 2022-11-08 21:12:14 -0500 | [diff] [blame] | 14 | import kotlin.collections.List |
| 15 | import kotlin.jvm.JvmStatic |
| 16 | |
| 17 | @Generated(value = ["androidx.room.RoomProcessor"]) |
elifbilgin | d46e8c1 | 2023-01-17 09:32:11 -0800 | [diff] [blame] | 18 | @Suppress(names = ["UNCHECKED_CAST", "DEPRECATION", "REDUNDANT_PROJECTION"]) |
Daniel Santiago Rivera | e695d18 | 2022-11-08 21:12:14 -0500 | [diff] [blame] | 19 | public class MyDao_Impl( |
| 20 | __db: RoomDatabase, |
| 21 | ) : MyDao { |
| 22 | private val __db: RoomDatabase |
| 23 | |
| 24 | private val __insertionAdapterOfMyEntity: EntityInsertionAdapter<MyEntity> |
| 25 | init { |
| 26 | this.__db = __db |
| 27 | this.__insertionAdapterOfMyEntity = object : EntityInsertionAdapter<MyEntity>(__db) { |
| 28 | public override fun createQuery(): String = |
| 29 | "INSERT OR ABORT INTO `MyEntity` (`pk`,`bar`) VALUES (?,?)" |
| 30 | |
Daniel Santiago Rivera | a6dec5a | 2023-05-02 15:09:07 -0400 | [diff] [blame] | 31 | public override fun bind(statement: SupportSQLiteStatement, entity: MyEntity) { |
Daniel Santiago Rivera | e695d18 | 2022-11-08 21:12:14 -0500 | [diff] [blame] | 32 | statement.bindLong(1, entity.pk.toLong()) |
| 33 | val _tmp: Foo = FooBarConverter.toFoo(entity.bar) |
| 34 | val _tmp_1: String = FooBarConverter.toString(_tmp) |
| 35 | statement.bindString(2, _tmp_1) |
| 36 | } |
| 37 | } |
| 38 | } |
| 39 | |
Daniel Santiago Rivera | a6dec5a | 2023-05-02 15:09:07 -0400 | [diff] [blame] | 40 | public override fun addEntity(item: MyEntity) { |
Daniel Santiago Rivera | e695d18 | 2022-11-08 21:12:14 -0500 | [diff] [blame] | 41 | __db.assertNotSuspendingTransaction() |
| 42 | __db.beginTransaction() |
| 43 | try { |
| 44 | __insertionAdapterOfMyEntity.insert(item) |
| 45 | __db.setTransactionSuccessful() |
| 46 | } finally { |
| 47 | __db.endTransaction() |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | public override fun getEntity(): MyEntity { |
| 52 | val _sql: String = "SELECT * FROM MyEntity" |
| 53 | val _statement: RoomSQLiteQuery = acquire(_sql, 0) |
| 54 | __db.assertNotSuspendingTransaction() |
| 55 | val _cursor: Cursor = query(__db, _statement, false, null) |
| 56 | try { |
| 57 | val _cursorIndexOfPk: Int = getColumnIndexOrThrow(_cursor, "pk") |
| 58 | val _cursorIndexOfBar: Int = getColumnIndexOrThrow(_cursor, "bar") |
| 59 | val _result: MyEntity |
| 60 | if (_cursor.moveToFirst()) { |
| 61 | val _tmpPk: Int |
| 62 | _tmpPk = _cursor.getInt(_cursorIndexOfPk) |
| 63 | val _tmpBar: Bar |
| 64 | val _tmp: String |
| 65 | _tmp = _cursor.getString(_cursorIndexOfBar) |
| 66 | val _tmp_1: Foo = FooBarConverter.fromString(_tmp) |
| 67 | _tmpBar = FooBarConverter.fromFoo(_tmp_1) |
| 68 | _result = MyEntity(_tmpPk,_tmpBar) |
| 69 | } else { |
elifbilgin | 22935ce | 2023-07-25 14:14:10 -0700 | [diff] [blame^] | 70 | error("The query result was empty, but expected a single row to return a NON-NULL object of type <MyEntity>.") |
Daniel Santiago Rivera | e695d18 | 2022-11-08 21:12:14 -0500 | [diff] [blame] | 71 | } |
| 72 | return _result |
| 73 | } finally { |
| 74 | _cursor.close() |
| 75 | _statement.release() |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | public companion object { |
| 80 | @JvmStatic |
| 81 | public fun getRequiredConverters(): List<Class<*>> = emptyList() |
| 82 | } |
| 83 | } |