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

Changeset 3591


Ignore:
Timestamp:
Jul 31, 2007, 9:48:23 PM (12 years ago)
Author:
ogawa
Message:

#1006:SQL標準化ブランチの取り込み(r3532,r3548)

Location:
OpenPNE/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE/trunk/webapp/lib/db/commu.php

    r3588 r3591  
    921921
    922922    $sql .= " AND cct.c_commu_id = ?" .
    923             " GROUP BY c_commu_topic_id " .
     923            " GROUP BY cct.c_commu_topic_id " .
    924924            " ORDER BY newest_write_datetime DESC";
    925925    $params = array(intval($c_commu_id));
     
    16601660    $select = 'SELECT c_commu.*';
    16611661
    1662     $where = ' WHERE 1';
     1662    $where = ' WHERE true';
    16631663    $params = array();
    16641664    if ($c_commu_category_id) {
     
    17361736    $sql = 'SELECT * FROM c_commu';
    17371737
    1738     $where = ' WHERE 1';
     1738    $where = ' WHERE true';
    17391739    $params = array();
    17401740    if ($search_word) {
  • OpenPNE/trunk/webapp/lib/db/member.php

    r3488 r3591  
    235235    $page_size = intval($page_size);
    236236
    237     $where = " WHERE 1";
     237    $where = " WHERE true";
    238238    $params = array();
    239239
  • OpenPNE/trunk/webapp/lib/db/review.php

    r3483 r3591  
    162162    $from = " FROM c_review INNER JOIN c_review_comment USING (c_review_id)";
    163163
    164     $where = ' WHERE 1';
     164    $where = ' WHERE true';
    165165    $params = array();
    166166    if ($keyword) {
     
    176176    case "r_datetime":
    177177    default:
    178         $order = " ORDER BY r_datetime DESC";
     178        $order = " ORDER BY r_datetime2 DESC";
    179179        break;
    180180    case "r_num":
     
    185185    $sql = "SELECT" .
    186186            " c_review.*" .
    187             ", MAX(c_review_comment.r_datetime) as r_datetime" .
     187            ", MAX(c_review_comment.r_datetime) as r_datetime2" .
    188188            ", COUNT(c_review_comment.c_review_comment_id) AS write_num" .
    189189        $from .
  • OpenPNE/trunk/webapp/lib/db/schedule.php

    r1856 r3591  
    5353    $sql = 'SELECT * FROM c_commu_topic WHERE c_commu_id IN ('.$ids.')' .
    5454            ' AND event_flag = 1 AND open_date > ? AND open_date <= ?';
     55
     56    $max_day = date("t", mktime(0,0,0,intval($month),1,intval($year) ));
    5557    $params = array(
    56         sprintf('%04d-%02d', intval($year), intval($month)) . '-00',
    57         sprintf('%04d-%02d', intval($year), intval($month)) . '-31'
     58        sprintf('%04d-%02d', intval($year), intval($month)) . '-01',
     59        sprintf('%04d-%02d', intval($year), intval($month)) . '-' . $max_day
    5860    );
     61
    5962    $list = db_get_all($sql, $params);
    6063
  • OpenPNE/trunk/webapp/modules/admin/do/csv_member.php

    r3296 r3591  
    4242        $params = array();
    4343        $sql = 'SELECT c_member_id FROM c_member ';
    44         $sql .= ' WHERE 1 ' ;
     44        $sql .= ' WHERE true ' ;
    4545        if ($start_id > 1) {
    4646            $sql .= ' AND c_member_id >= ? ';
  • OpenPNE/trunk/webapp/modules/admin/lib/db_admin.php

    r3483 r3591  
    177177    pne_cache_drop('db_member_c_profile_list');
    178178
     179    if (empty($info) || is_null($info)) {
     180        $info = '';
     181    }
     182
    179183    $data = array(
    180184        'name' => $name,
     
    215219    )
    216220{
     221    if (empty($info) || is_null($info)) {
     222        $info = '';
     223    }
     224
    217225    $data = array(
    218226        'name' => $name,
     
    546554    $sql = 'SELECT c_member_id'.
    547555           ' FROM c_member'.
    548            ' WHERE 1';
     556           ' WHERE true';
    549557
    550558    //開始年
     
    685693    if (!empty($cond_list['is_pc_address']) || !empty($cond_list['is_ktai_address'])) {
    686694
    687         $sql = 'SELECT c_member_id FROM c_member_secure WHERE 1';
     695        $sql = 'SELECT c_member_id FROM c_member_secure WHERE true';
    688696
    689697        //PCアドレスの有無で絞る
     
    933941function p_access_analysis_month_access_analysis_month($ktai_flag)
    934942{
    935     $sql = "SELECT concat(left(r_datetime, 7), '-01') as ym, count(*) as count" .
     943    $sql = "SELECT date_format(r_datetime, '%Y-%m-01') as ym, count(*) as count" .
    936944            " FROM c_access_log " .
    937945            " where ktai_flag = ?" .
     
    11071115    }
    11081116    $sql .= " and target_c_commu_id <> 0 ";
    1109     $sql .= " group by target_c_commu_id " .$orderby_str." limit $start, $page_size";
    1110     $list = db_get_all($sql,$params);
     1117
     1118    $sql .= " group by target_c_commu_id " .$orderby_str;
     1119    $list = db_get_all_limit($sql, $start, $page_size, $params);
    11111120
    11121121    $return = array();
     
    11861195    }
    11871196    $sql = "select target_c_commu_topic_id , count(*) as count from c_access_log ";
    1188     $sql .= $where." group by target_c_commu_topic_id " .$orderby_str." limit $start, $page_size";
    1189     $list = db_get_all($sql,$params);
     1197    $sql .= $where." group by target_c_commu_topic_id " .$orderby_str;
     1198    $list = db_get_all_limit($sql, $start, $page_size, $params);
    11901199    $sql = "select count(*) from c_access_log ";
    11911200    $sql .= $where ." group by target_c_commu_topic_id ";
     
    12561265    }
    12571266    $sql .= " and target_c_diary_id <> 0 ";
    1258     $sql .= " group by target_c_diary_id " . $orderby_str. " limit $start, $page_size";
    1259     $list = db_get_all($sql,$params);
     1267    $sql .= " group by target_c_diary_id " . $orderby_str;
     1268    $list = db_get_all_limit($sql, $start, $page_size, $params);
    12601269
    12611270    $return = array();
     
    13351344
    13361345    $sql = "select c_member_id , count(*) as count from c_access_log";
    1337     $sql .= $where." group by c_member_id $orderby_str limit $start, $page_size";
    1338     $list = db_get_all($sql,$params);
     1346    $sql .= $where." group by c_member_id $orderby_str";
     1347    $list = db_get_all_limit($sql, $start, $page_size, $params);
    13391348    $sql = "select count(*) from c_access_log ";
    13401349    $sql .=    $where ." group by c_member_id ";
     
    14021411    $sql .= $where;
    14031412    $sql .= " AND target_c_member_id <> 0 ";
    1404     $sql .= " group by target_c_member_id " . $orderby_str. " limit $start, $page_size";
    1405 
    1406     $list = db_get_all($sql,$params);
     1413    $sql .= " group by target_c_member_id " . $orderby_str;
     1414
     1415    $list = db_get_all_limit($sql, $start, $page_size, $params);
    14071416
    14081417    $return = array();
     
    15141523    //page_sizeが0の時は全て表示(pagerなし)
    15151524    if ($page_size != 0) {
    1516         $limit = " LIMIT ".($page_size*($page-1)).",$page_size";
    1517     }
    1518     $where = " WHERE 1 ";
     1525        $limit = " OFFSET ".($page_size*($page-1))." LIMIT ".$page_size;
     1526    }
     1527    $where = " WHERE true ";
    15191528
    15201529    //指定された条件で絞っていく
     
    15321541    $order = " order by c_member_id";
    15331542
    1534     $sql = $select . $where . $order . $limit;
     1543    $sql = $select . $where . $order;
    15351544    $list = db_get_all_limit($sql, 0, $limit, $params);
    15361545   
     
    17441753    $page_size = intval($page_size);
    17451754   
    1746     $where = " where 1 ";
     1755    $where = " where true ";
    17471756
    17481757    if ($keyword) {
     
    18241833    $page_size = intval($page_size);
    18251834   
    1826     $where = " where 1 ";
     1835    $where = " where true ";
    18271836
    18281837    if ($keyword) {
     
    19031912    $page_size = intval($page_size);
    19041913   
    1905     $where = " where 1 ";
     1914    $where = " where true ";
    19061915
    19071916    if ($keyword) {
     
    19841993    $page_size = intval($page_size);
    19851994   
    1986     $where = " where 1 ";
     1995    $where = " where true ";
    19871996
    19881997    if ($keyword) {
     
    20672076    $page_size = intval($page_size);
    20682077   
    2069     $where = " where 1 ";
     2078    $where = " where true ";
    20702079
    20712080    if ($keyword) {
     
    21542163    $page_size = intval($page_size);
    21552164   
    2156     $where = " where 1 ";
     2165    $where = " where true ";
    21572166
    21582167    if ($keyword) {
  • OpenPNE/trunk/webapp_biz/modules/biz/lib/mysql_functions.php

    r3224 r3591  
    374374    //keywordあり
    375375    if ($keyword) {
    376         $where = ' WHERE 1 AND (info LIKE ? OR name LIKE ?) ORDER BY ?';
     376        $where = ' WHERE true AND (info LIKE ? OR name LIKE ?) ORDER BY ?';
    377377        $sql = 'SELECT * FROM biz_group'. $where;
    378378
     
    447447    if ($id) {
    448448        $params[] = intval($id);
    449         $sql = 'SELECT * FROM `biz_shisetsu_schedule` WHERE `date` = "?-?-?" AND biz_shisetsu_id = ? ORDER BY begin_time ASC';
     449        $sql = 'SELECT * FROM biz_shisetsu_schedule WHERE date = "?-?-?" AND biz_shisetsu_id = ? ORDER BY begin_time ASC';
    450450    } else {
    451         $sql = 'SELECT * FROM `biz_shisetsu_schedule` WHERE `date` = "?-?-?" ORDER BY begin_time ASC';
     451        $sql = 'SELECT * FROM biz_shisetsu_schedule WHERE date = "?-?-?" ORDER BY begin_time ASC';
    452452    }
    453453    $list = db_get_all($sql, $params);
     
    466466function biz_getShisetsuScheduleID($id)
    467467{
    468     $sql = 'SELECT * FROM `biz_shisetsu_schedule` WHERE biz_shisetsu_schedule_id = ?';
     468    $sql = 'SELECT * FROM biz_shisetsu_schedule WHERE biz_shisetsu_schedule_id = ?';
    469469
    470470    $params = array(
     
    547547    $contain = array();
    548548
    549     $sql = 'SELECT biz_schedule_id FROM biz_schedule WHERE 1 AND (begin_date LIKE \''.$y.'-'.$m.'%\' OR finish_date LIKE \''.$y.'-'.$m.'%\') AND begin_date != finish_date';
     549    $sql = 'SELECT biz_schedule_id FROM biz_schedule WHERE true AND (begin_date LIKE \''.$y.'-'.$m.'%\' OR finish_date LIKE \''.$y.'-'.$m.'%\') AND begin_date != finish_date';
    550550    $tmp = db_get_all($sql, $params);
    551551
     
    890890                                                    $id, $join_members = array())
    891891{
    892     $sql = 'UPDATE `biz_schedule` SET `title` = ?,`c_member_id` = ?,`begin_date` = ?,`finish_date` = ?,`begin_time` = ?,`finish_time` = ?,`value` = ?,`rep_type` = ?,`rep_first` = ?, `biz_group_id` = ?, `public_flag` = ?, `is_read` = 0 WHERE `biz_schedule_id` = ?';
     892    $sql = 'UPDATE biz_schedule SET title = ?,c_member_id = ?,begin_date = ?,finish_date = ?,begin_time = ?,finish_time = ?,value = ?,rep_type = ?,rep_first = ?, biz_group_id = ?, public_flag = ?, is_read = 0 WHERE biz_schedule_id = ?';
    893893    $params = array(
    894894        $title,
     
    907907    db_query($sql, $params);
    908908   
    909     $sql = 'DELETE FROM `biz_schedule_member` WHERE `biz_schedule_id` = ?';
     909    $sql = 'DELETE FROM biz_schedule_member WHERE biz_schedule_id = ?';
    910910    $params = array(
    911911        intval($id),
     
    934934    $sid = db_get_one($sql, $params);
    935935
    936     $sql = 'UPDATE `biz_schedule_member` SET `is_read` = \'1\' WHERE `biz_schedule_member_id` = ?';
     936    $sql = 'UPDATE biz_schedule_member SET is_read = \'1\' WHERE biz_schedule_member_id = ?';
    937937    $params = array(
    938938        intval($sid),
     
    990990    //biz_groupにデータを追加する
    991991
    992     $sql = 'UPDATE `biz_group` SET `name` = ?,`info` = ?,`image_filename` = ? WHERE `biz_group_id` = ?';
     992    $sql = 'UPDATE biz_group SET name = ?,info = ?,image_filename = ? WHERE biz_group_id = ?';
    993993    $params = array(
    994994        $name,
     
    10681068    }
    10691069
    1070     $sql = 'UPDATE `biz_shisetsu` SET `name` = ?,`image_filename` = ?, `info` = ? WHERE `biz_shisetsu_id` = ?';
     1070    $sql = 'UPDATE biz_shisetsu SET name = ?,image_filename = ?, info = ? WHERE biz_shisetsu_id = ?';
    10711071    $params = array(
    10721072        $name,
     
    10941094function biz_deleteShisetsuSchedule($shisetsu_id)
    10951095{
    1096     $sql = 'DELETE FROM `biz_shisetsu_schedule` WHERE biz_shisetsu_schedule_id = ?';
     1096    $sql = 'DELETE FROM biz_shisetsu_schedule WHERE biz_shisetsu_schedule_id = ?';
    10971097    $params = array(
    10981098        intval($shisetsu_id),
     
    11461146    }
    11471147   
    1148     $sql = 'UPDATE `biz_todo` SET `c_member_id` = ?, `memo` = ?, `writer_id` = ?,'
    1149         .'`r_datetime` = ?, `due_datetime` = ?, `priority` = ?, `biz_group_id` = ?,'
    1150         .'`public_flag` = ? WHERE `biz_todo_id` = ?';
     1148    $sql = 'UPDATE biz_todo SET c_member_id = ?, memo = ?, writer_id = ?,'
     1149        .'r_datetime = ?, due_datetime = ?, priority = ?, biz_group_id = ?,'
     1150        .'public_flag = ? WHERE biz_todo_id = ?';
    11511151
    11521152    $params = array(
     
    11871187    if ($is_check) {
    11881188    //チェックを解除する
    1189         $sql = 'UPDATE `biz_todo` SET `is_check` = \'0\' WHERE `biz_todo_id` = ?';
     1189        $sql = 'UPDATE biz_todo SET is_check = \'0\' WHERE biz_todo_id = ?';
    11901190    } else {
    11911191    //チェックをつける
    1192         $sql = 'UPDATE `biz_todo` SET `is_check` = \'1\' WHERE `biz_todo_id` = ?';
     1192        $sql = 'UPDATE biz_todo SET is_check = \'1\' WHERE biz_todo_id = ?';
    11931193    }
    11941194
     
    12611261function biz_deleteGroupImage($id, $filename)
    12621262{
    1263     $sql = 'UPDATE `biz_group` SET `image_filename` = \'0\' WHERE `biz_group_id` = ?';
     1263    $sql = 'UPDATE biz_group SET image_filename = \'0\' WHERE biz_group_id = ?';
    12641264    $params = array(
    12651265        intval($id),
     
    12711271function biz_deleteShisetsuImage($id, $filename)
    12721272{
    1273     $sql = 'UPDATE `biz_shisetsu` SET `image_filename` = \'0\' WHERE `biz_shisetsu_id` = ?';
     1273    $sql = 'UPDATE biz_shisetsu SET image_filename = \'0\' WHERE biz_shisetsu_id = ?';
    12741274
    12751275    $params = array(
     
    12831283function biz_changeNickname($member_id, $new)
    12841284{
    1285     $sql = 'UPDATE `c_member` SET `nickname` = ? WHERE `c_member_id` = ?';
     1285    $sql = 'UPDATE c_member SET nickname = ? WHERE c_member_id = ?';
    12861286    $params = array(
    12871287        $new,
     
    13031303    biz_deleteShisetsuImage($id, $shisetsu['image_filename']);
    13041304
    1305     $sql = 'DELETE FROM `biz_shisetsu` WHERE biz_shisetsu_id = ?';
     1305    $sql = 'DELETE FROM biz_shisetsu WHERE biz_shisetsu_id = ?';
    13061306    $params = array(
    13071307        intval($id),
Note: See TracChangeset for help on using the changeset viewer.