blob: 5b3ff162c3b4133a633d6fa4aadc13476cb5f769 [file] [log] [blame]
Daniel Santiago Riverae695d182022-11-08 21:12:14 -05001import android.database.Cursor
2import androidx.room.EntityInsertionAdapter
3import androidx.room.RoomDatabase
4import androidx.room.RoomSQLiteQuery
5import androidx.room.RoomSQLiteQuery.Companion.acquire
6import androidx.room.util.getColumnIndexOrThrow
7import androidx.room.util.query
8import androidx.sqlite.db.SupportSQLiteStatement
9import java.lang.Class
10import javax.`annotation`.processing.Generated
11import kotlin.Int
12import kotlin.String
13import kotlin.Suppress
Daniel Santiago Riverae695d182022-11-08 21:12:14 -050014import kotlin.collections.List
15import kotlin.jvm.JvmStatic
16
17@Generated(value = ["androidx.room.RoomProcessor"])
elifbilgind46e8c12023-01-17 09:32:11 -080018@Suppress(names = ["UNCHECKED_CAST", "DEPRECATION", "REDUNDANT_PROJECTION"])
Daniel Santiago Riverae695d182022-11-08 21:12:14 -050019public 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 Riveraa6dec5a2023-05-02 15:09:07 -040031 public override fun bind(statement: SupportSQLiteStatement, entity: MyEntity) {
Daniel Santiago Riverae695d182022-11-08 21:12:14 -050032 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 Riveraa6dec5a2023-05-02 15:09:07 -040040 public override fun addEntity(item: MyEntity) {
Daniel Santiago Riverae695d182022-11-08 21:12:14 -050041 __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 {
elifbilgin22935ce2023-07-25 14:14:10 -070070 error("The query result was empty, but expected a single row to return a NON-NULL object of type <MyEntity>.")
Daniel Santiago Riverae695d182022-11-08 21:12:14 -050071 }
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}