Daniel Santiago Rivera | 155f7ec | 2022-09-26 22:36:29 -0400 | [diff] [blame] | 1 | import android.database.Cursor |
Daniel Santiago Rivera | 0552a38 | 2022-10-05 23:11:51 -0400 | [diff] [blame] | 2 | import androidx.room.EntityInsertionAdapter |
Daniel Santiago Rivera | 885c9eb | 2022-09-29 21:49:35 -0400 | [diff] [blame] | 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 |
Daniel Santiago Rivera | 0552a38 | 2022-10-05 23:11:51 -0400 | [diff] [blame] | 8 | import androidx.sqlite.db.SupportSQLiteStatement |
Daniel Santiago Rivera | 885c9eb | 2022-09-29 21:49:35 -0400 | [diff] [blame] | 9 | import java.lang.Class |
Daniel Santiago Rivera | 155f7ec | 2022-09-26 22:36:29 -0400 | [diff] [blame] | 10 | import javax.`annotation`.processing.Generated |
| 11 | import kotlin.Byte |
| 12 | import kotlin.Char |
| 13 | import kotlin.Double |
| 14 | import kotlin.Float |
| 15 | import kotlin.Int |
| 16 | import kotlin.Long |
| 17 | import kotlin.Short |
Daniel Santiago Rivera | 885c9eb | 2022-09-29 21:49:35 -0400 | [diff] [blame] | 18 | import kotlin.String |
Daniel Santiago Rivera | 155f7ec | 2022-09-26 22:36:29 -0400 | [diff] [blame] | 19 | import kotlin.Suppress |
Daniel Santiago Rivera | 885c9eb | 2022-09-29 21:49:35 -0400 | [diff] [blame] | 20 | import kotlin.collections.List |
| 21 | import kotlin.jvm.JvmStatic |
Daniel Santiago Rivera | 155f7ec | 2022-09-26 22:36:29 -0400 | [diff] [blame] | 22 | |
| 23 | @Generated(value = ["androidx.room.RoomProcessor"]) |
elifbilgin | d46e8c1 | 2023-01-17 09:32:11 -0800 | [diff] [blame] | 24 | @Suppress(names = ["UNCHECKED_CAST", "DEPRECATION", "REDUNDANT_PROJECTION"]) |
Daniel Santiago Rivera | e695d18 | 2022-11-08 21:12:14 -0500 | [diff] [blame] | 25 | public class MyDao_Impl( |
| 26 | __db: RoomDatabase, |
| 27 | ) : MyDao { |
Daniel Santiago Rivera | 885c9eb | 2022-09-29 21:49:35 -0400 | [diff] [blame] | 28 | private val __db: RoomDatabase |
| 29 | |
Daniel Santiago Rivera | 0552a38 | 2022-10-05 23:11:51 -0400 | [diff] [blame] | 30 | private val __insertionAdapterOfMyEntity: EntityInsertionAdapter<MyEntity> |
Daniel Santiago Rivera | e695d18 | 2022-11-08 21:12:14 -0500 | [diff] [blame] | 31 | init { |
Daniel Santiago Rivera | 885c9eb | 2022-09-29 21:49:35 -0400 | [diff] [blame] | 32 | this.__db = __db |
Daniel Santiago Rivera | 0552a38 | 2022-10-05 23:11:51 -0400 | [diff] [blame] | 33 | this.__insertionAdapterOfMyEntity = object : EntityInsertionAdapter<MyEntity>(__db) { |
| 34 | public override fun createQuery(): String = |
| 35 | "INSERT OR ABORT INTO `MyEntity` (`int`,`short`,`byte`,`long`,`char`,`float`,`double`) VALUES (?,?,?,?,?,?,?)" |
| 36 | |
Daniel Santiago Rivera | a6dec5a | 2023-05-02 15:09:07 -0400 | [diff] [blame] | 37 | public override fun bind(statement: SupportSQLiteStatement, entity: MyEntity) { |
Daniel Santiago Rivera | bb3ff86 | 2023-03-24 10:55:09 -0400 | [diff] [blame] | 38 | val _tmpInt: Int? = entity.int |
| 39 | if (_tmpInt == null) { |
Daniel Santiago Rivera | 0552a38 | 2022-10-05 23:11:51 -0400 | [diff] [blame] | 40 | statement.bindNull(1) |
| 41 | } else { |
Daniel Santiago Rivera | bb3ff86 | 2023-03-24 10:55:09 -0400 | [diff] [blame] | 42 | statement.bindLong(1, _tmpInt.toLong()) |
Daniel Santiago Rivera | 0552a38 | 2022-10-05 23:11:51 -0400 | [diff] [blame] | 43 | } |
Daniel Santiago Rivera | bb3ff86 | 2023-03-24 10:55:09 -0400 | [diff] [blame] | 44 | val _tmpShort: Short? = entity.short |
| 45 | if (_tmpShort == null) { |
Daniel Santiago Rivera | 0552a38 | 2022-10-05 23:11:51 -0400 | [diff] [blame] | 46 | statement.bindNull(2) |
| 47 | } else { |
Daniel Santiago Rivera | bb3ff86 | 2023-03-24 10:55:09 -0400 | [diff] [blame] | 48 | statement.bindLong(2, _tmpShort.toLong()) |
Daniel Santiago Rivera | 0552a38 | 2022-10-05 23:11:51 -0400 | [diff] [blame] | 49 | } |
Daniel Santiago Rivera | bb3ff86 | 2023-03-24 10:55:09 -0400 | [diff] [blame] | 50 | val _tmpByte: Byte? = entity.byte |
| 51 | if (_tmpByte == null) { |
Daniel Santiago Rivera | 0552a38 | 2022-10-05 23:11:51 -0400 | [diff] [blame] | 52 | statement.bindNull(3) |
| 53 | } else { |
Daniel Santiago Rivera | bb3ff86 | 2023-03-24 10:55:09 -0400 | [diff] [blame] | 54 | statement.bindLong(3, _tmpByte.toLong()) |
Daniel Santiago Rivera | 0552a38 | 2022-10-05 23:11:51 -0400 | [diff] [blame] | 55 | } |
Daniel Santiago Rivera | bb3ff86 | 2023-03-24 10:55:09 -0400 | [diff] [blame] | 56 | val _tmpLong: Long? = entity.long |
| 57 | if (_tmpLong == null) { |
Daniel Santiago Rivera | 0552a38 | 2022-10-05 23:11:51 -0400 | [diff] [blame] | 58 | statement.bindNull(4) |
| 59 | } else { |
Daniel Santiago Rivera | bb3ff86 | 2023-03-24 10:55:09 -0400 | [diff] [blame] | 60 | statement.bindLong(4, _tmpLong) |
Daniel Santiago Rivera | 0552a38 | 2022-10-05 23:11:51 -0400 | [diff] [blame] | 61 | } |
Daniel Santiago Rivera | bb3ff86 | 2023-03-24 10:55:09 -0400 | [diff] [blame] | 62 | val _tmpChar: Char? = entity.char |
| 63 | if (_tmpChar == null) { |
Daniel Santiago Rivera | 0552a38 | 2022-10-05 23:11:51 -0400 | [diff] [blame] | 64 | statement.bindNull(5) |
| 65 | } else { |
Daniel Santiago Rivera | bb3ff86 | 2023-03-24 10:55:09 -0400 | [diff] [blame] | 66 | statement.bindLong(5, _tmpChar.toLong()) |
Daniel Santiago Rivera | 0552a38 | 2022-10-05 23:11:51 -0400 | [diff] [blame] | 67 | } |
Daniel Santiago Rivera | bb3ff86 | 2023-03-24 10:55:09 -0400 | [diff] [blame] | 68 | val _tmpFloat: Float? = entity.float |
| 69 | if (_tmpFloat == null) { |
Daniel Santiago Rivera | 0552a38 | 2022-10-05 23:11:51 -0400 | [diff] [blame] | 70 | statement.bindNull(6) |
| 71 | } else { |
Daniel Santiago Rivera | bb3ff86 | 2023-03-24 10:55:09 -0400 | [diff] [blame] | 72 | statement.bindDouble(6, _tmpFloat.toDouble()) |
Daniel Santiago Rivera | 0552a38 | 2022-10-05 23:11:51 -0400 | [diff] [blame] | 73 | } |
Daniel Santiago Rivera | bb3ff86 | 2023-03-24 10:55:09 -0400 | [diff] [blame] | 74 | val _tmpDouble: Double? = entity.double |
| 75 | if (_tmpDouble == null) { |
Daniel Santiago Rivera | 0552a38 | 2022-10-05 23:11:51 -0400 | [diff] [blame] | 76 | statement.bindNull(7) |
| 77 | } else { |
Daniel Santiago Rivera | bb3ff86 | 2023-03-24 10:55:09 -0400 | [diff] [blame] | 78 | statement.bindDouble(7, _tmpDouble) |
Daniel Santiago Rivera | 0552a38 | 2022-10-05 23:11:51 -0400 | [diff] [blame] | 79 | } |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | |
Daniel Santiago Rivera | a6dec5a | 2023-05-02 15:09:07 -0400 | [diff] [blame] | 84 | public override fun addEntity(item: MyEntity) { |
Daniel Santiago Rivera | 0552a38 | 2022-10-05 23:11:51 -0400 | [diff] [blame] | 85 | __db.assertNotSuspendingTransaction() |
| 86 | __db.beginTransaction() |
| 87 | try { |
| 88 | __insertionAdapterOfMyEntity.insert(item) |
| 89 | __db.setTransactionSuccessful() |
| 90 | } finally { |
| 91 | __db.endTransaction() |
| 92 | } |
Daniel Santiago Rivera | 885c9eb | 2022-09-29 21:49:35 -0400 | [diff] [blame] | 93 | } |
| 94 | |
| 95 | public override fun getEntity(): MyEntity { |
| 96 | val _sql: String = "SELECT * FROM MyEntity" |
| 97 | val _statement: RoomSQLiteQuery = acquire(_sql, 0) |
| 98 | __db.assertNotSuspendingTransaction() |
| 99 | val _cursor: Cursor = query(__db, _statement, false, null) |
| 100 | try { |
| 101 | val _cursorIndexOfInt: Int = getColumnIndexOrThrow(_cursor, "int") |
| 102 | val _cursorIndexOfShort: Int = getColumnIndexOrThrow(_cursor, "short") |
| 103 | val _cursorIndexOfByte: Int = getColumnIndexOrThrow(_cursor, "byte") |
| 104 | val _cursorIndexOfLong: Int = getColumnIndexOrThrow(_cursor, "long") |
| 105 | val _cursorIndexOfChar: Int = getColumnIndexOrThrow(_cursor, "char") |
| 106 | val _cursorIndexOfFloat: Int = getColumnIndexOrThrow(_cursor, "float") |
| 107 | val _cursorIndexOfDouble: Int = getColumnIndexOrThrow(_cursor, "double") |
| 108 | val _result: MyEntity |
| 109 | if (_cursor.moveToFirst()) { |
| 110 | val _tmpInt: Int? |
| 111 | if (_cursor.isNull(_cursorIndexOfInt)) { |
| 112 | _tmpInt = null |
| 113 | } else { |
| 114 | _tmpInt = _cursor.getInt(_cursorIndexOfInt) |
| 115 | } |
| 116 | val _tmpShort: Short? |
| 117 | if (_cursor.isNull(_cursorIndexOfShort)) { |
| 118 | _tmpShort = null |
| 119 | } else { |
| 120 | _tmpShort = _cursor.getShort(_cursorIndexOfShort) |
| 121 | } |
| 122 | val _tmpByte: Byte? |
| 123 | if (_cursor.isNull(_cursorIndexOfByte)) { |
| 124 | _tmpByte = null |
| 125 | } else { |
| 126 | _tmpByte = _cursor.getShort(_cursorIndexOfByte).toByte() |
| 127 | } |
| 128 | val _tmpLong: Long? |
| 129 | if (_cursor.isNull(_cursorIndexOfLong)) { |
| 130 | _tmpLong = null |
| 131 | } else { |
| 132 | _tmpLong = _cursor.getLong(_cursorIndexOfLong) |
| 133 | } |
| 134 | val _tmpChar: Char? |
| 135 | if (_cursor.isNull(_cursorIndexOfChar)) { |
| 136 | _tmpChar = null |
| 137 | } else { |
| 138 | _tmpChar = _cursor.getInt(_cursorIndexOfChar).toChar() |
| 139 | } |
| 140 | val _tmpFloat: Float? |
| 141 | if (_cursor.isNull(_cursorIndexOfFloat)) { |
| 142 | _tmpFloat = null |
| 143 | } else { |
| 144 | _tmpFloat = _cursor.getFloat(_cursorIndexOfFloat) |
| 145 | } |
| 146 | val _tmpDouble: Double? |
| 147 | if (_cursor.isNull(_cursorIndexOfDouble)) { |
| 148 | _tmpDouble = null |
| 149 | } else { |
| 150 | _tmpDouble = _cursor.getDouble(_cursorIndexOfDouble) |
| 151 | } |
| 152 | _result = MyEntity(_tmpInt,_tmpShort,_tmpByte,_tmpLong,_tmpChar,_tmpFloat,_tmpDouble) |
| 153 | } else { |
elifbilgin | 22935ce | 2023-07-25 14:14:10 -0700 | [diff] [blame^] | 154 | error("The query result was empty, but expected a single row to return a NON-NULL object of type <MyEntity>.") |
Daniel Santiago Rivera | 885c9eb | 2022-09-29 21:49:35 -0400 | [diff] [blame] | 155 | } |
| 156 | return _result |
| 157 | } finally { |
| 158 | _cursor.close() |
| 159 | _statement.release() |
Daniel Santiago Rivera | 155f7ec | 2022-09-26 22:36:29 -0400 | [diff] [blame] | 160 | } |
Daniel Santiago Rivera | 885c9eb | 2022-09-29 21:49:35 -0400 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | public companion object { |
| 164 | @JvmStatic |
| 165 | public fun getRequiredConverters(): List<Class<*>> = emptyList() |
Daniel Santiago Rivera | 155f7ec | 2022-09-26 22:36:29 -0400 | [diff] [blame] | 166 | } |
| 167 | } |