Daniel Santiago Rivera | bb3ff86 | 2023-03-24 10:55:09 -0400 | [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.Long |
| 13 | import kotlin.String |
| 14 | import kotlin.Suppress |
Daniel Santiago Rivera | bb3ff86 | 2023-03-24 10:55:09 -0400 | [diff] [blame] | 15 | import kotlin.collections.List |
| 16 | import kotlin.jvm.JvmStatic |
| 17 | |
| 18 | @Generated(value = ["androidx.room.RoomProcessor"]) |
| 19 | @Suppress(names = ["UNCHECKED_CAST", "DEPRECATION", "REDUNDANT_PROJECTION"]) |
| 20 | public class MyDao_Impl( |
| 21 | __db: RoomDatabase, |
| 22 | ) : MyDao { |
| 23 | private val __db: RoomDatabase |
| 24 | |
| 25 | private val __insertionAdapterOfMyEntity: EntityInsertionAdapter<MyEntity> |
| 26 | init { |
| 27 | this.__db = __db |
| 28 | this.__insertionAdapterOfMyEntity = object : EntityInsertionAdapter<MyEntity>(__db) { |
| 29 | public override fun createQuery(): String = |
| 30 | "INSERT OR ABORT INTO `MyEntity` (`pk`,`primitive`,`string`,`nullableString`,`fieldString`,`nullableFieldString`,`variablePrimitive`,`variableString`,`variableNullableString`,`variableFieldString`,`variableNullableFieldString`) VALUES (?,?,?,?,?,?,?,?,?,?,?)" |
| 31 | |
Daniel Santiago Rivera | a6dec5a | 2023-05-02 15:09:07 -0400 | [diff] [blame^] | 32 | public override fun bind(statement: SupportSQLiteStatement, entity: MyEntity) { |
Daniel Santiago Rivera | bb3ff86 | 2023-03-24 10:55:09 -0400 | [diff] [blame] | 33 | statement.bindLong(1, entity.pk.toLong()) |
| 34 | statement.bindLong(2, entity.primitive) |
| 35 | statement.bindString(3, entity.string) |
| 36 | val _tmpNullableString: String? = entity.nullableString |
| 37 | if (_tmpNullableString == null) { |
| 38 | statement.bindNull(4) |
| 39 | } else { |
| 40 | statement.bindString(4, _tmpNullableString) |
| 41 | } |
| 42 | statement.bindString(5, entity.fieldString) |
| 43 | val _tmpNullableFieldString: String? = entity.nullableFieldString |
| 44 | if (_tmpNullableFieldString == null) { |
| 45 | statement.bindNull(6) |
| 46 | } else { |
| 47 | statement.bindString(6, _tmpNullableFieldString) |
| 48 | } |
| 49 | statement.bindLong(7, entity.variablePrimitive) |
| 50 | statement.bindString(8, entity.variableString) |
| 51 | val _tmpVariableNullableString: String? = entity.variableNullableString |
| 52 | if (_tmpVariableNullableString == null) { |
| 53 | statement.bindNull(9) |
| 54 | } else { |
| 55 | statement.bindString(9, _tmpVariableNullableString) |
| 56 | } |
| 57 | statement.bindString(10, entity.variableFieldString) |
| 58 | val _tmpVariableNullableFieldString: String? = entity.variableNullableFieldString |
| 59 | if (_tmpVariableNullableFieldString == null) { |
| 60 | statement.bindNull(11) |
| 61 | } else { |
| 62 | statement.bindString(11, _tmpVariableNullableFieldString) |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | |
Daniel Santiago Rivera | a6dec5a | 2023-05-02 15:09:07 -0400 | [diff] [blame^] | 68 | public override fun addEntity(item: MyEntity) { |
Daniel Santiago Rivera | bb3ff86 | 2023-03-24 10:55:09 -0400 | [diff] [blame] | 69 | __db.assertNotSuspendingTransaction() |
| 70 | __db.beginTransaction() |
| 71 | try { |
| 72 | __insertionAdapterOfMyEntity.insert(item) |
| 73 | __db.setTransactionSuccessful() |
| 74 | } finally { |
| 75 | __db.endTransaction() |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | public override fun getEntity(): MyEntity { |
| 80 | val _sql: String = "SELECT * FROM MyEntity" |
| 81 | val _statement: RoomSQLiteQuery = acquire(_sql, 0) |
| 82 | __db.assertNotSuspendingTransaction() |
| 83 | val _cursor: Cursor = query(__db, _statement, false, null) |
| 84 | try { |
| 85 | val _cursorIndexOfPk: Int = getColumnIndexOrThrow(_cursor, "pk") |
| 86 | val _cursorIndexOfPrimitive: Int = getColumnIndexOrThrow(_cursor, "primitive") |
| 87 | val _cursorIndexOfString: Int = getColumnIndexOrThrow(_cursor, "string") |
| 88 | val _cursorIndexOfNullableString: Int = getColumnIndexOrThrow(_cursor, "nullableString") |
| 89 | val _cursorIndexOfFieldString: Int = getColumnIndexOrThrow(_cursor, "fieldString") |
| 90 | val _cursorIndexOfNullableFieldString: Int = getColumnIndexOrThrow(_cursor, |
| 91 | "nullableFieldString") |
| 92 | val _cursorIndexOfVariablePrimitive: Int = getColumnIndexOrThrow(_cursor, "variablePrimitive") |
| 93 | val _cursorIndexOfVariableString: Int = getColumnIndexOrThrow(_cursor, "variableString") |
| 94 | val _cursorIndexOfVariableNullableString: Int = getColumnIndexOrThrow(_cursor, |
| 95 | "variableNullableString") |
| 96 | val _cursorIndexOfVariableFieldString: Int = getColumnIndexOrThrow(_cursor, |
| 97 | "variableFieldString") |
| 98 | val _cursorIndexOfVariableNullableFieldString: Int = getColumnIndexOrThrow(_cursor, |
| 99 | "variableNullableFieldString") |
| 100 | val _result: MyEntity |
| 101 | if (_cursor.moveToFirst()) { |
| 102 | val _tmpPk: Int |
| 103 | _tmpPk = _cursor.getInt(_cursorIndexOfPk) |
| 104 | val _tmpPrimitive: Long |
| 105 | _tmpPrimitive = _cursor.getLong(_cursorIndexOfPrimitive) |
| 106 | val _tmpString: String |
| 107 | _tmpString = _cursor.getString(_cursorIndexOfString) |
| 108 | val _tmpNullableString: String? |
| 109 | if (_cursor.isNull(_cursorIndexOfNullableString)) { |
| 110 | _tmpNullableString = null |
| 111 | } else { |
| 112 | _tmpNullableString = _cursor.getString(_cursorIndexOfNullableString) |
| 113 | } |
| 114 | val _tmpFieldString: String |
| 115 | _tmpFieldString = _cursor.getString(_cursorIndexOfFieldString) |
| 116 | val _tmpNullableFieldString: String? |
| 117 | if (_cursor.isNull(_cursorIndexOfNullableFieldString)) { |
| 118 | _tmpNullableFieldString = null |
| 119 | } else { |
| 120 | _tmpNullableFieldString = _cursor.getString(_cursorIndexOfNullableFieldString) |
| 121 | } |
| 122 | _result = |
| 123 | MyEntity(_tmpPk,_tmpPrimitive,_tmpString,_tmpNullableString,_tmpFieldString,_tmpNullableFieldString) |
| 124 | _result.variablePrimitive = _cursor.getLong(_cursorIndexOfVariablePrimitive) |
| 125 | _result.variableString = _cursor.getString(_cursorIndexOfVariableString) |
| 126 | if (_cursor.isNull(_cursorIndexOfVariableNullableString)) { |
| 127 | _result.variableNullableString = null |
| 128 | } else { |
| 129 | _result.variableNullableString = _cursor.getString(_cursorIndexOfVariableNullableString) |
| 130 | } |
| 131 | _result.variableFieldString = _cursor.getString(_cursorIndexOfVariableFieldString) |
| 132 | if (_cursor.isNull(_cursorIndexOfVariableNullableFieldString)) { |
| 133 | _result.variableNullableFieldString = null |
| 134 | } else { |
| 135 | _result.variableNullableFieldString = |
| 136 | _cursor.getString(_cursorIndexOfVariableNullableFieldString) |
| 137 | } |
| 138 | } else { |
| 139 | error("Cursor was empty, but expected a single item.") |
| 140 | } |
| 141 | return _result |
| 142 | } finally { |
| 143 | _cursor.close() |
| 144 | _statement.release() |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | public companion object { |
| 149 | @JvmStatic |
| 150 | public fun getRequiredConverters(): List<Class<*>> = emptyList() |
| 151 | } |
| 152 | } |