房间查询中的“=”和“==”有什么区别?
What is the difference between "=" and "==" in Room queries?
@Query("SELECT * FROM table where age = :age")
fun getAge(age: Int)
@Query("DELETE FROM table where name == :name")
suspend fun deleteName(name: String): Int?
一个查询使用=
,另一个使用==
,我想知道它们之间有什么区别吗?
实际上没有区别,sqlite中的等于运算符有两个变体,来自SQL Language Expressions
Note that there are two variations of the equals and not equals
operators. Equals can be either =
or ==
. The non-equals operator can
be either !=
or <>
.
@Query("SELECT * FROM table where age = :age")
fun getAge(age: Int)
@Query("DELETE FROM table where name == :name")
suspend fun deleteName(name: String): Int?
一个查询使用=
,另一个使用==
,我想知道它们之间有什么区别吗?
实际上没有区别,sqlite中的等于运算符有两个变体,来自SQL Language Expressions
Note that there are two variations of the equals and not equals operators. Equals can be either
=
or==
. The non-equals operator can be either!=
or<>
.