ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 6205


Ignore:
Timestamp:
Mar 31, 2008, 7:01:17 PM (13 years ago)
Author:
toraneko
Message:

参加コミュ最新トピックのSQLをWHERE INからINNER JOINに変更

File:
1 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE/branches/work/toraneko/prj_dbtuning/webapp/lib/db/commu.php

    r6182 r6205  
    841841                ' AND cctc.r_datetime=sub_cct_tbl.r_datetime' .
    842842            ' ORDER BY r_datetime DESC';
     843        $params = array();
    843844    } else {
    844         $sql = 'SELECT c_commu_topic_id, c_commu_id, r_datetime_comment as r_datetime, c_member_id,'.
    845             ' name as c_commu_topic_name'.
    846             ' FROM c_commu_topic'. $hint . ' WHERE c_commu_id IN (' . $ids . ') '.
     845        $sql = 'SELECT a.c_commu_topic_id, a.c_commu_id, a.r_datetime_comment as r_datetime, a.c_member_id,'.
     846            ' a.name as c_commu_topic_name'.
     847            ' FROM c_commu_topic as a INNER JOIN c_commu_member as b USING(c_commu_id)'.
     848            ' WHERE b.c_member_id = ?'.
    847849            ' ORDER BY r_datetime DESC';
    848     }
    849     $c_commu_topic_list = db_get_all_limit($sql, 0, $limit);
     850        $params = array(intval($c_member_id));
     851    }
     852    $c_commu_topic_list = db_get_all_limit($sql, 0, $limit, $params);
    850853
    851854    foreach ($c_commu_topic_list as $key => $value) {
     
    896899                ' AND cctc.r_datetime=sub_cct_tbl.r_datetime' .
    897900            ' ORDER BY r_datetime DESC';
     901        $params = array();
    898902    } else {
    899         $sql = 'SELECT c_commu_topic_id, c_commu_id, r_datetime_comment as r_datetime, c_member_id,'.
    900             ' name as c_commu_topic_name'.
    901             ' FROM c_commu_topic'. $hint . ' WHERE c_commu_id IN (' . $ids . ')'.
     903        $sql = 'SELECT a.c_commu_topic_id, a.c_commu_id, a.r_datetime_comment as r_datetime, a.c_member_id,'.
     904            ' a.name as c_commu_topic_name'.
     905            ' FROM c_commu_topic as a INNER JOIN c_commu_member as b USING(c_commu_id)'.
     906            ' WHERE b.c_member_id = ?'.
    902907            ' ORDER BY r_datetime DESC';
    903     }
    904     $c_commu_topic_list = db_get_all_limit($sql, ($page-1)*$limit, $limit);
     908        $params = array(intval($c_member_id));
     909    }
     910    $c_commu_topic_list = db_get_all_limit($sql, ($page-1)*$limit, $limit, $params);
    905911
    906912    foreach ($c_commu_topic_list as $key => $value) {
Note: See TracChangeset for help on using the changeset viewer.