gpt4 book ai didi

android - DBFlow 选择列表中的哪个 COLUMN?

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:17:05 24 4
gpt4 key购买 nike

我正在尝试在我的数据库中查询列表中具有主键的所有模型。这是我的查询(idsList 是一个包含整数的 ArrayList):

new Select().from(PostModel.class)
.where(Condition.column(PostModel$Table.ID).in(0, idsList))
.async().queryList(listener);

但是 Android Studio 会突出显示 where 条件,声明

"Cannot resolve method 'where(com.raizlabs.android.dbflow.sql.builder.Condition.In)"

那么 Condition.In 不被认为是条件吗?如何在 ArrayList 中查询所有具有主键的模型?

我正在使用 DBFlow 2.0。我也可以使用常规 SQL 查询字符串作为替代,但我不太精通 SQL,因此如果您能为我的问题提供一个 SQL 查询字符串,那将是一个可能的解决方法。

最佳答案

DBFlow v3.x 现在允许您将集合传递给 Condition.in()

List<String> ids = new ArrayList<>();

Condition.In in = Condition.column(Tree_Table.ID.getNameAlias()).in(ids);

long count = new Select().count().from(Tree.class)
.where(in)
.count();

关于android - DBFlow 选择列表中的哪个 COLUMN?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30194674/

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