2

What is the best way to join the results of a Facebook api query with my own MySQL database? I am trying to display a list of blogs that my friends are following. I am using the android Facebook sdk 3.0. Here is how I am getting a list of my friends, which works fine.

Session session  = Session.getActiveSession();

    if(session.isOpened())
    {
        Request.executeMyFriendsRequestAsync(session, new Request.GraphUserListCallback() 
        {

            @Override
            public void onCompleted(List<GraphUser> users, Response response) 
            {
                updateUI(users);
            }


        });
    }

I need to join these results with my own database in order to display a list of blogs that my friends are following. I have a database table like this:

Table name: blog_followers
Columns: id, user_id, blog_id

The result should be this: 7 of your friends are following "How to grill food".

I have a users table also:

Table name: users
Columns: id, email, facebook_id

I just need to do a join using my friends' facebook id's, my users table, and my blog_followers table. What is the best way to do this for Android?

4

1 回答 1

1
  1. 使用 SQLIN()运算符过滤您的表,如将 Facebook 朋友列表数组与 MySQL 表比较中所示;或者

  2. 将 Facebook 结果集推送到一个临时表中,然后像往常一样将其连接到 RDBMS 中的现有数据。

    CREATE TABLE语法中所述:

    临时表

    TEMPORARY创建表时可以使用关键字。TEMPORARY表仅对当前连接可见,并在连接关闭时自动删除。这意味着两个不同的连接可以使用相同的临时表名,而不会相互冲突或与现有TEMPORARY的同名非表冲突。(在删除临时表之前,现有表是隐藏的。)要创建临时表,您必须具有CREATE TEMPORARY TABLES特权。

于 2013-07-13T18:03:27.303 回答