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

Ignore:
Timestamp:
Jul 10, 2007, 6:11:42 PM (15 years ago)
Author:
ToshihiroK
Message:

postgres対応

File:
1 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE/branches/prj/postgres/2_8_1/webapp/lib/db/diary.php

    r3057 r3402  
    528528            ' AND c_diary.c_member_id NOT IN (' . $except_ids . ')' .
    529529            ' AND c_diary.public_flag <> \'private\'';
     530
    530531    $params = array(intval($c_member_id), $date);
    531532    $c_diary_id_list = db_get_col($sql, $params);
    532533    $c_diary_id_list = array_unique($c_diary_id_list);
     534
    533535    if (!$c_diary_id_list) {
    534536        return array();
     
    566568    $firends[] = 0;
    567569    $friend_ids = implode(',', $friends);
    568 
     570   
    569571    $sql = 'SELECT d.c_diary_id' .
    570572            ', d.subject' .
    571573            ', d.c_member_id' .
    572             ', MAX(dc.r_datetime) AS r_datetime' .
    573             ', COUNT(DISTINCT dc.c_diary_comment_id) AS num_comment' .
     574            ', sub_diary_tbl.r_datetime' .
     575            ', sub_diary_tbl.num_comment' .
    574576        ' FROM c_diary AS d' .
    575             ' INNER JOIN c_diary_comment AS dc USING (c_diary_id)' .
    576             ', c_diary_comment AS mydc' .
    577         ' WHERE mydc.c_member_id = ?' .
    578             ' AND mydc.c_diary_id = d.c_diary_id' .
    579             ' AND mydc.c_member_id <> d.c_member_id' .
    580             ' AND d.c_member_id NOT IN (' . $except_ids . ')' .
    581             ' AND (d.public_flag = \'public\' OR (d.public_flag = \'friend\' AND d.c_member_id IN (' . $friend_ids . ')))' .
    582         ' GROUP BY dc.c_diary_id' .
     577            ', ( SELECT dc.c_diary_id' .
     578                    ', MAX(dc.r_datetime) AS r_datetime' .
     579                    ', COUNT(DISTINCT dc.c_diary_comment_id) AS num_comment' .
     580                ' FROM c_diary AS d' .
     581                    ' INNER JOIN c_diary_comment AS dc USING (c_diary_id)' .
     582                    ', c_diary_comment AS mydc' .
     583                ' WHERE mydc.c_member_id = ?' .
     584                    ' AND mydc.c_diary_id = d.c_diary_id' .
     585                    ' AND mydc.c_member_id <> d.c_member_id' .
     586                    ' AND d.c_member_id NOT IN (' . $except_ids . ')' .
     587                    ' AND (d.public_flag = \'public\' OR (d.public_flag = \'friend\' AND d.c_member_id IN (' . $friend_ids . ')))' .
     588                ' GROUP BY dc.c_diary_id' .
     589            ') as sub_diary_tbl' .
     590        ' WHERE' .
     591            ' sub_diary_tbl.c_diary_id = d.c_diary_id' .
    583592        ' ORDER BY r_datetime DESC';
    584593
     
    789798
    790799    $pf_cond = db_diary_public_flag_condition($c_member_id, $u);
    791     $sql = 'SELECT DISTINCT DAYOFMONTH(r_datetime) FROM c_diary' .
    792            ' WHERE c_member_id = ? AND r_datetime >= ? AND r_datetime < ?' . $pf_cond;
     800    $sql = "SELECT DISTINCT date_part('day', r_datetime) FROM c_diary" .
     801           " WHERE c_member_id = ? AND r_datetime >= ? AND r_datetime < ?" . $pf_cond;
    793802
    794803    $date_format = '%Y-%m-%d 00:00:00';
     
    10861095{
    10871096    $data = array(
    1088         'is_checked' => (bool)$value,
     1097        'is_checked' => (int)$value,
    10891098    );
    10901099    $where = 'c_diary_id = '.intval($c_diary_id);
Note: See TracChangeset for help on using the changeset viewer.