Daniel Santiago Rivera | 9160ec6 | 2022-11-11 12:32:31 -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.getColumnIndex |
| 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.Boolean |
| 12 | import kotlin.Int |
| 13 | import kotlin.Long |
| 14 | import kotlin.String |
| 15 | import kotlin.Suppress |
Daniel Santiago Rivera | 9160ec6 | 2022-11-11 12:32:31 -0500 | [diff] [blame] | 16 | import kotlin.collections.List |
| 17 | import kotlin.jvm.JvmStatic |
| 18 | |
| 19 | @Generated(value = ["androidx.room.RoomProcessor"]) |
elifbilgin | d46e8c1 | 2023-01-17 09:32:11 -0800 | [diff] [blame] | 20 | @Suppress(names = ["UNCHECKED_CAST", "DEPRECATION", "REDUNDANT_PROJECTION"]) |
Daniel Santiago Rivera | 9160ec6 | 2022-11-11 12:32:31 -0500 | [diff] [blame] | 21 | public class MyDao_Impl( |
| 22 | __db: RoomDatabase, |
| 23 | ) : MyDao { |
| 24 | private val __db: RoomDatabase |
| 25 | |
| 26 | private val __insertionAdapterOfMyEntity: EntityInsertionAdapter<MyEntity> |
| 27 | init { |
| 28 | this.__db = __db |
| 29 | this.__insertionAdapterOfMyEntity = object : EntityInsertionAdapter<MyEntity>(__db) { |
| 30 | public override fun createQuery(): String = |
| 31 | "INSERT OR ABORT INTO `MyEntity` (`valuePrimitive`,`valueBoolean`,`valueString`,`valueNullableString`,`variablePrimitive`,`variableNullableBoolean`,`variableString`,`variableNullableString`) VALUES (?,?,?,?,?,?,?,?)" |
| 32 | |
Daniel Santiago Rivera | a6dec5a | 2023-05-02 15:09:07 -0400 | [diff] [blame] | 33 | public override fun bind(statement: SupportSQLiteStatement, entity: MyEntity) { |
Daniel Santiago Rivera | 9160ec6 | 2022-11-11 12:32:31 -0500 | [diff] [blame] | 34 | statement.bindLong(1, entity.valuePrimitive) |
| 35 | val _tmp: Int = if (entity.valueBoolean) 1 else 0 |
| 36 | statement.bindLong(2, _tmp.toLong()) |
| 37 | statement.bindString(3, entity.valueString) |
Daniel Santiago Rivera | bb3ff86 | 2023-03-24 10:55:09 -0400 | [diff] [blame] | 38 | val _tmpValueNullableString: String? = entity.valueNullableString |
| 39 | if (_tmpValueNullableString == null) { |
Daniel Santiago Rivera | 9160ec6 | 2022-11-11 12:32:31 -0500 | [diff] [blame] | 40 | statement.bindNull(4) |
| 41 | } else { |
Daniel Santiago Rivera | bb3ff86 | 2023-03-24 10:55:09 -0400 | [diff] [blame] | 42 | statement.bindString(4, _tmpValueNullableString) |
Daniel Santiago Rivera | 9160ec6 | 2022-11-11 12:32:31 -0500 | [diff] [blame] | 43 | } |
| 44 | statement.bindLong(5, entity.variablePrimitive) |
| 45 | val _tmpVariableNullableBoolean: Boolean? = entity.variableNullableBoolean |
| 46 | val _tmp_1: Int? = _tmpVariableNullableBoolean?.let { if (it) 1 else 0 } |
| 47 | if (_tmp_1 == null) { |
| 48 | statement.bindNull(6) |
| 49 | } else { |
| 50 | statement.bindLong(6, _tmp_1.toLong()) |
| 51 | } |
| 52 | statement.bindString(7, entity.variableString) |
| 53 | val _tmpVariableNullableString: String? = entity.variableNullableString |
| 54 | if (_tmpVariableNullableString == null) { |
| 55 | statement.bindNull(8) |
| 56 | } else { |
| 57 | statement.bindString(8, _tmpVariableNullableString) |
| 58 | } |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | |
Daniel Santiago Rivera | a6dec5a | 2023-05-02 15:09:07 -0400 | [diff] [blame] | 63 | public override fun addEntity(item: MyEntity) { |
Daniel Santiago Rivera | 9160ec6 | 2022-11-11 12:32:31 -0500 | [diff] [blame] | 64 | __db.assertNotSuspendingTransaction() |
| 65 | __db.beginTransaction() |
| 66 | try { |
| 67 | __insertionAdapterOfMyEntity.insert(item) |
| 68 | __db.setTransactionSuccessful() |
| 69 | } finally { |
| 70 | __db.endTransaction() |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | public override fun getEntity(): MyEntity { |
| 75 | val _sql: String = "SELECT * FROM MyEntity" |
| 76 | val _statement: RoomSQLiteQuery = acquire(_sql, 0) |
| 77 | __db.assertNotSuspendingTransaction() |
| 78 | val _cursor: Cursor = query(__db, _statement, false, null) |
| 79 | try { |
| 80 | val _result: MyEntity |
| 81 | if (_cursor.moveToFirst()) { |
| 82 | _result = __entityCursorConverter_MyEntity(_cursor) |
| 83 | } else { |
elifbilgin | 22935ce | 2023-07-25 14:14:10 -0700 | [diff] [blame^] | 84 | error("The query result was empty, but expected a single row to return a NON-NULL object of type <MyEntity>.") |
Daniel Santiago Rivera | 9160ec6 | 2022-11-11 12:32:31 -0500 | [diff] [blame] | 85 | } |
| 86 | return _result |
| 87 | } finally { |
| 88 | _cursor.close() |
| 89 | _statement.release() |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | private fun __entityCursorConverter_MyEntity(cursor: Cursor): MyEntity { |
| 94 | val _entity: MyEntity |
| 95 | val _cursorIndexOfValuePrimitive: Int = getColumnIndex(cursor, "valuePrimitive") |
| 96 | val _cursorIndexOfValueBoolean: Int = getColumnIndex(cursor, "valueBoolean") |
| 97 | val _cursorIndexOfValueString: Int = getColumnIndex(cursor, "valueString") |
| 98 | val _cursorIndexOfValueNullableString: Int = getColumnIndex(cursor, "valueNullableString") |
| 99 | val _cursorIndexOfVariablePrimitive: Int = getColumnIndex(cursor, "variablePrimitive") |
| 100 | val _cursorIndexOfVariableNullableBoolean: Int = getColumnIndex(cursor, |
| 101 | "variableNullableBoolean") |
| 102 | val _cursorIndexOfVariableString: Int = getColumnIndex(cursor, "variableString") |
| 103 | val _cursorIndexOfVariableNullableString: Int = getColumnIndex(cursor, "variableNullableString") |
| 104 | val _tmpValuePrimitive: Long |
| 105 | if (_cursorIndexOfValuePrimitive == -1) { |
| 106 | _tmpValuePrimitive = 0 |
| 107 | } else { |
| 108 | _tmpValuePrimitive = cursor.getLong(_cursorIndexOfValuePrimitive) |
| 109 | } |
| 110 | val _tmpValueBoolean: Boolean |
| 111 | if (_cursorIndexOfValueBoolean == -1) { |
| 112 | _tmpValueBoolean = false |
| 113 | } else { |
| 114 | val _tmp: Int |
| 115 | _tmp = cursor.getInt(_cursorIndexOfValueBoolean) |
| 116 | _tmpValueBoolean = _tmp != 0 |
| 117 | } |
| 118 | val _tmpValueString: String |
| 119 | if (_cursorIndexOfValueString == -1) { |
elifbilgin | 22935ce | 2023-07-25 14:14:10 -0700 | [diff] [blame^] | 120 | error("Missing value for a NON-NULL column 'valueString', found NULL value instead.") |
Daniel Santiago Rivera | 9160ec6 | 2022-11-11 12:32:31 -0500 | [diff] [blame] | 121 | } else { |
| 122 | _tmpValueString = cursor.getString(_cursorIndexOfValueString) |
| 123 | } |
| 124 | val _tmpValueNullableString: String? |
| 125 | if (_cursorIndexOfValueNullableString == -1) { |
| 126 | _tmpValueNullableString = null |
| 127 | } else { |
| 128 | if (cursor.isNull(_cursorIndexOfValueNullableString)) { |
| 129 | _tmpValueNullableString = null |
| 130 | } else { |
| 131 | _tmpValueNullableString = cursor.getString(_cursorIndexOfValueNullableString) |
| 132 | } |
| 133 | } |
| 134 | _entity = MyEntity(_tmpValuePrimitive,_tmpValueBoolean,_tmpValueString,_tmpValueNullableString) |
| 135 | if (_cursorIndexOfVariablePrimitive != -1) { |
| 136 | _entity.variablePrimitive = cursor.getLong(_cursorIndexOfVariablePrimitive) |
| 137 | } |
| 138 | if (_cursorIndexOfVariableNullableBoolean != -1) { |
| 139 | val _tmp_1: Int? |
| 140 | if (cursor.isNull(_cursorIndexOfVariableNullableBoolean)) { |
| 141 | _tmp_1 = null |
| 142 | } else { |
| 143 | _tmp_1 = cursor.getInt(_cursorIndexOfVariableNullableBoolean) |
| 144 | } |
| 145 | _entity.variableNullableBoolean = _tmp_1?.let { it != 0 } |
| 146 | } |
| 147 | if (_cursorIndexOfVariableString != -1) { |
| 148 | _entity.variableString = cursor.getString(_cursorIndexOfVariableString) |
| 149 | } |
| 150 | if (_cursorIndexOfVariableNullableString != -1) { |
| 151 | if (cursor.isNull(_cursorIndexOfVariableNullableString)) { |
| 152 | _entity.variableNullableString = null |
| 153 | } else { |
| 154 | _entity.variableNullableString = cursor.getString(_cursorIndexOfVariableNullableString) |
| 155 | } |
| 156 | } |
| 157 | return _entity |
| 158 | } |
| 159 | |
| 160 | public companion object { |
| 161 | @JvmStatic |
| 162 | public fun getRequiredConverters(): List<Class<*>> = emptyList() |
| 163 | } |
| 164 | } |