Reputation: 195
In the Dao Interface I need to use
@Query("UPDATE table SET user_name = value")
fun addValue(value: String)
Here value is not recognized as the input from the function addValue(value:String)
IDE reports value is an Unresolved symbol How do make value from the function be recognised as input in the SQL statement
I'm assuming it might have something to do with Entities what Entities to I need to include in my Database class
Here
@Database(Entities = MyEntity::class], version = 1)
abstract class MyEntityDatabase: Room database()
Upvotes: 0
Views: 40
Reputation: 2056
The room provides colon operator to resolve the argument in the query. So you query @Query("UPDATE table SET user_name = value")
will be changed to Query("UPDATE table SET user_name = :value")
then room can resolve the argument.
So it should be like
@Query("UPDATE table SET user_name = :argName")
fun addValue(argName: String)
Upvotes: 2