gpt4 book ai didi

android - 如何一次组合多个解析查询

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

我有两个解析查询,我想通过单击按钮对其进行评估。我在 Parse 中有两个类(class)。我想同时检查这两件事。我的查询是:

                ParseQuery<ParseObject> query =ParseQuery.getQuery("Login");
query.whereEqualTo("x",X);
query.whereEqualTo("y",Y);

在登录的同时,我正在检查两个实体之间的关系。我的第二个查询是:

                ParseQuery<ParseObject> query1 =ParseQuery.getQuery("UserData");
query.whereEqualTo("entity1",entity1);
query.whereEqualTo("entity2",entity2);

现在,如果两个查询都成功,则用户可以处理该应用程序。我怎样才能组合这两个查询,以便两个查询都必须成功

最佳答案

使用复合查询。下面的示例取自 www.parse.com 上的 Parse Docs

ParseQuery<ParseObject> lotsOfWins = ParseQuery.getQuery("Player");
lotsOfWins.whereGreaterThan(150);

ParseQuery<ParseObject> fewWins = ParseQuery.getQuery("Player");
fewWins.whereLessThan(5);

List<ParseQuery<ParseObject>> queries = new ArrayList<ParseQuery<ParseObject>>();
queries.add(lotsOfWins);
queries.add(fewWins);

ParseQuery<ParseObject> mainQuery = ParseQuery.or(queries);
mainQuery.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> results, ParseException e) {
// results has the list of players that win a lot or haven't won much.
}
});

关于android - 如何一次组合多个解析查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28108635/

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