如何在 Android 中的 Facebook 查询请求中使用数组参数。

发布于 2024-11-27 08:02:19 字数 366 浏览 1 评论 0原文

现在,我正在使用 Android 的 Bundle 创建对 Facebook 查询语言的请求。

Bundle params = new Bundle();
params.putString("method", "fql.query");
params.putString("query", "SELECT * FROM * WHERE source_id = *");
mAsyncRunner.request(params, new ExampleRequestListener());

从 PHP 示例中,我看到了作为查询参数发送的用户 ID 数组,但是如何将数组添加到此包中,以从 Java 发出对安卓应用程序?

感谢您的帮助。

Right now I am using Android's Bundle to create requests for Facebook Query Language

Bundle params = new Bundle();
params.putString("method", "fql.query");
params.putString("query", "SELECT * FROM * WHERE source_id = *");
mAsyncRunner.request(params, new ExampleRequestListener());

From PHP examples I have seen arrays of user IDs sent as a parameter for a query, but how can I add an array to this bundle to make the request from Java for an Android application?

Thanks for help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

送你一个梦 2024-12-04 08:02:19

我非常确定您发送到 FQL 的查询与您使用 Bundle、Android 和 Java 的事实没有什么关系 - 神奇的事情将发生在 FQL 查询本身中。

对多个 UID 进行 FQL 查询的规范示例似乎是这样的:

$fql = "SELECT name FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())";

或来自 fql multiquery 文档:

"query1":"SELECT uid, rsvp_status FROM event_member WHERE eid=12345678"
"query2":"SELECT name, url, pic FROM profile WHERE id IN (SELECT uid FROM #query1)"

因此,对于您的情况,我将修改带有查询的行。我也注意到你

SELECT * FROM * 

在那一行。您确定不想选择桌子吗?
例如:

params.putString("query", "SELECT * FROM user WHERE uid in [YOUR SOURCE LIST]);

I'm pretty sure that the query you send to FQL has little to do with the fact that you are using Bundle, Android and Java - the magic will happen in the FQL query itself.

The canonical example for an FQL query on multiple UIDs seems to go something like this:

$fql = "SELECT name FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())";

or from fql multiquery documentation:

"query1":"SELECT uid, rsvp_status FROM event_member WHERE eid=12345678"
"query2":"SELECT name, url, pic FROM profile WHERE id IN (SELECT uid FROM #query1)"

So for your case I would modify the line with the query. I also notice that you have

SELECT * FROM * 

in that line. are you sure you don't want to choose a table?
For instance:

params.putString("query", "SELECT * FROM user WHERE uid in [YOUR SOURCE LIST]);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文