gpt4 book ai didi

parse-platform - 在 Parse 中使用指针获取关系数据

转载 作者:行者123 更新时间:2023-12-04 06:46:28 24 4
gpt4 key购买 nike

我们正面临从关系表读取数据的问题。我们有 table1,它的一列中有一个指向另一个表的指针,称为 table2。我们需要在一个查询请求中从 table1 的指针获取 table2 中的数据。

所以,现在的查询是:

PFQuery *query = [PFQuery queryWithClassName:@"table1"];
[query whereKey:@"completed" equalTo:[NSNumber numberWithBool:NO]];
[query whereKey:@"userId" equalTo:[PFObject objectWithoutDataWithClassName:@"Users" objectId:@"someID"]];

[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error)
{
if (!error)
{

//new user
if(objects.count==0)
{

}

else
{
//here we get "Users:vAJS2T96V1" ,which is the pointer to table2 ,but we need to go deeper to the other table
// in the same query, and get the data from table2 .
}
}

}];

我们如何在一个查询中从 table2 获取数据?

最佳答案

您使用“includeKey”从另一个表中获取数据:

[query includeKey:@"Users"];

更多信息: http://blog.parse.com/2011/12/06/queries-for-relational-data/

关于parse-platform - 在 Parse 中使用指针获取关系数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21674824/

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