gpt4 book ai didi

android - FQL : Unexpected end of query

转载 作者:行者123 更新时间:2023-11-29 01:53:03 24 4
gpt4 key购买 nike

我正在尝试检索已邀请登录用户参加的 Activity 。当我测试一些东西时,我在尝试这个 FQL 查询时遇到了这个错误:

public static List<GraphLocation> getEvents(Session session, Map<String, Object> queryParams){
limpar();

queryStringBuilder.append("SELECT eid, all_members_count, attending_count, declined_count, description, end_time, version, " +
"name, location, pic, privacy, start_time, ticket_uri, timezone, unsure_count, venue " +
"FROM event");

if(queryParams != null && !queryParams.isEmpty()){
whereClause.append(" WHERE ");

if(!queryParams.containsKey("dataInicio")){
whereClause.append("start_time = " + formatter.format((Date) queryParams.get("dataInicio")));
}
}

queryStringBuilder.append(whereClause.toString());

Bundle params = new Bundle();
params.putString("q", queryStringBuilder.toString());

Request request = new Request(session, "/fql", params, HttpMethod.GET,
new Request.Callback() {

@Override
public void onCompleted(Response response) {
System.out.println(response.toString());
}
});

Request.executeBatchAsync(request);

return null;
}
private static void limpar(){
queryStringBuilder = new StringBuilder();
whereClause = new StringBuilder();
}

这是 imageshack 上图像错误的链接:http://img163.imageshack.us/img163/6848/erroew.png

如果有人能告诉我为什么会出现这个问题,我会很高兴,无论如何,如果有人能告诉我如何获取特定用户受邀参加的 Activity ,我会更高兴。

非常感谢。

最佳答案

FQL 查询需要一个 WHERE 语句,这是“查询意外结束”异常的原因。

您要找的Query就是这个

SELECT eid, all_members_count, attending_count, declined_count, description, end_time, version, name, location, pic, privacy, start_time, ticket_uri, timezone, unsure_count, venue 
FROM event WHERE eid IN ( SELECT eid FROM event_member WHERE uid = XXXXXXX )
ORDER BY start_time asc

将 XXXXXXX 替换为 Facebook 用户 ID。

为了在将 FQL 查询集成到您的代码之前对其进行测试,您可以使用 Facebook Graph API Explorer,例如 here .

注意:不要忘记为您的 Facebook 应用添加“user_events”权限。

关于android - FQL : Unexpected end of query,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16800258/

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