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

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

postgres対応

File:
1 edited

Legend:

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

    r3057 r3402  
    573573        'body'       => $body,
    574574        'r_datetime' => db_now(),
    575         'is_send'    => (bool)$is_send,
     575        'is_send'    => (int)$is_send,
    576576    );
    577577    $where = array('c_message_id' => intval($c_message_id));
     
    790790function db_message_c_message_sender_list4c_member_id($c_member_id)
    791791{
    792     $sql = "SELECT distinct c_member_id_from FROM c_message";
     792
    793793    $where = "c_member_id_to = ?".
    794794            " AND is_deleted_to = 0" .
    795795            " AND is_send = 1";
    796     $sql .= " WHERE $where";
     796
     797    $sql = "SELECT c_member_id_from" .
     798            " FROM" .
     799                "(" .
     800                    "SELECT distinct on(c_member_id_from) *" .
     801                    " FROM" .
     802                        " c_message" .
     803                    " WHERE " . $where .
     804                ") as sub_member_tbl";
     805   
    797806    $sql .= " ORDER BY r_datetime DESC";
    798807    $params = array(intval($c_member_id));
     
    811820function db_message_c_message_receiver_list4c_member_id($c_member_id)
    812821{
    813     $sql = "SELECT distinct c_member_id_to FROM c_message";
    814822    $where = "c_member_id_from = ?".
    815823            " AND is_deleted_from = 0" .
    816824            " AND is_send = 1";
    817     $sql .= " WHERE $where";
     825    $sql = "SELECT c_member_id_to" .
     826            " FROM" .
     827                "(" .
     828                    "SELECT distinct on(c_member_id_to) *" .
     829                    " FROM" .
     830                        " c_message" .
     831                    " WHERE " . $where .
     832                ") as sub_member_tbl";
     833
    818834    $sql .= " ORDER BY r_datetime DESC";
    819835    $params = array(intval($c_member_id));
     
    903919    }
    904920
    905     $sql = 'SELECT DISTINCT DAYOFMONTH(r_datetime) FROM c_message' .
     921    $sql = "SELECT DISTINCT date_part('day', r_datetime) FROM c_message" .
    906922           " WHERE $where" .
    907923           ' AND is_send=1 AND r_datetime >= ? AND r_datetime < ?';
Note: See TracChangeset for help on using the changeset viewer.