问题描述
为什么IN子句/运算符无法从表中检索type1,type2行?
这写在main.kt文件中
//if i write here **var type="type1"** then the DAO fetches correct result
but i want to fetch both type1 and type2. So,I am writing it in following way
and then passing the "type" variable as "bind variable" in DAO
but nothing is fetched and the output is blank//
var type="'type1','type2'"
var sq = runBlocking {qdatabase(applicationContext).getquizdao().engquest(type).shuffled()}
这是用DAO编写的
@Query("SELECT * FROM tabledata WHERE Subject='English' AND Qtype IN(:types)")
suspend fun engquest(types:String):List<quizdata>
这是数据库。
Question|Subject| Qtype |
------ |-------|------ |
Quest1 |English| type1 |
Quest2 |English| type2 |
Quest3 |English| type3 |
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)