gpt4 book ai didi

android - ActiveAndroid 中的多参数

转载 作者:太空宇宙 更新时间:2023-11-03 12:06:41 24 4
gpt4 key购买 nike

我在我的项目中使用 ActiveAndroid 作为 ORM 系统,我使用这行代码对数据库进行查询

 List<Chats> s = new Select()
.from(Chats.class)
.where(col_conversation + " = ? and " + col_sender + " = ? and " + col_body + " = ?",conversation.getId(),sender.getId(),body) .execute();

但结果是获取 0 行。我确定我在数据库中有这样的行。

最佳答案

另一种方法是使用多个where子句来执行多参数查询:

List<Chats> s = new Select()
.from(Chats.class)
.where(col_conversation + " = ?",conversation.getId())
.where(col_sender + " = ?", sender.getId())
.where(body + " = ?", body)
.execute();

关于android - ActiveAndroid 中的多参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28169063/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com