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

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_biz/modules/biz/lib/mysql_functions.php

    r3224 r3402  
    232232    );
    233233
    234     $ids = db_get_col($sql, $param);
     234    $ids = db_get_col($sql, $params);
    235235
    236236    $schedule = array();
     
    336336    $sql = "SELECT * FROM biz_group_member";
    337337    $sql .= " WHERE c_member_id = ?";
    338     $sql .= " ORDER BY RAND()";
     338    $sql .= " ORDER BY RANDOM()";
    339339
    340340    $params = array(
     
    369369
    370370//指定された条件に見合うグループのリストを得る関数
    371 function biz_getGroupList($keyword = '', $page = 0, $page_size = 20, $order = 'biz_group_id')
     371function biz_getGroupList($keyword = '', $page = 0, $page_size = 20, $order = "biz_group_id")
    372372{
    373373
    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 ' . $order;
    377377        $sql = 'SELECT * FROM biz_group'. $where;
    378378
     
    380380            '%'.$keyword.'%',
    381381            '%'.$keyword.'%',
    382             $order,
    383382        );
    384383        $list = db_get_all_page($sql, $page, $page_size, $params);
     
    386385    } else {
    387386        $where = '';
    388         $sql = 'SELECT * FROM biz_group ORDER BY ? desc';
     387        $sql = 'SELECT * FROM biz_group ORDER BY ' . $order . ' desc';
    389388
    390389        $params = array(
    391             $order,
    392390        );
    393391        $list = db_get_all_page($sql, $page, $page_size, $params);
     
    447445    if ($id) {
    448446        $params[] = intval($id);
    449         $sql = 'SELECT * FROM `biz_shisetsu_schedule` WHERE `date` = "?-?-?" AND biz_shisetsu_id = ? ORDER BY begin_time ASC';
     447        $sql = "SELECT * FROM biz_shisetsu_schedule WHERE date = '?-?-?' AND biz_shisetsu_id = ? ORDER BY begin_time ASC";
    450448    } else {
    451         $sql = 'SELECT * FROM `biz_shisetsu_schedule` WHERE `date` = "?-?-?" ORDER BY begin_time ASC';
     449        $sql = "SELECT * FROM biz_shisetsu_schedule WHERE date = '?-?-?' ORDER BY begin_time ASC";
    452450    }
    453451    $list = db_get_all($sql, $params);
     
    459457        $list[$key]['c_member_name'] = db_get_one($sql, $params);
    460458    }
    461 
    462459    return $list;
    463460}
     
    466463function biz_getShisetsuScheduleID($id)
    467464{
    468     $sql = 'SELECT * FROM `biz_shisetsu_schedule` WHERE biz_shisetsu_schedule_id = ?';
     465    $sql = 'SELECT * FROM biz_shisetsu_schedule WHERE biz_shisetsu_schedule_id = ?';
    469466
    470467    $params = array(
     
    547544    $contain = array();
    548545
    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';
     546    $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';
    550547    $tmp = db_get_all($sql, $params);
    551548
     
    890887                                                    $id, $join_members = array())
    891888{
    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` = ?';
     889    $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 = ?';
     890   
     891    //登録値のセット、チェック
     892    if (!$value) {
     893        $value = '';
     894    }
     895
     896    if (!$rep_type) {
     897        $rep_type = 0;
     898    }
     899
    893900    $params = array(
    894901        $title,
     
    907914    db_query($sql, $params);
    908915   
    909     $sql = 'DELETE FROM `biz_schedule_member` WHERE `biz_schedule_id` = ?';
     916    $sql = 'DELETE FROM biz_schedule_member WHERE biz_schedule_id = ?';
    910917    $params = array(
    911918        intval($id),
     
    934941    $sid = db_get_one($sql, $params);
    935942
    936     $sql = 'UPDATE `biz_schedule_member` SET `is_read` = \'1\' WHERE `biz_schedule_member_id` = ?';
     943    $sql = 'UPDATE biz_schedule_member SET is_read = \'1\' WHERE biz_schedule_member_id = ?';
    937944    $params = array(
    938945        intval($sid),
     
    990997    //biz_groupにデータを追加する
    991998
    992     $sql = 'UPDATE `biz_group` SET `name` = ?,`info` = ?,`image_filename` = ? WHERE `biz_group_id` = ?';
     999    $sql = 'UPDATE biz_group SET name = ?,info = ?,image_filename = ? WHERE biz_group_id = ?';
    9931000    $params = array(
    9941001        $name,
     
    10681075    }
    10691076
    1070     $sql = 'UPDATE `biz_shisetsu` SET `name` = ?,`image_filename` = ?, `info` = ? WHERE `biz_shisetsu_id` = ?';
     1077    $sql = 'UPDATE biz_shisetsu SET name = ?,image_filename = ?, info = ? WHERE biz_shisetsu_id = ?';
    10711078    $params = array(
    10721079        $name,
     
    10941101function biz_deleteShisetsuSchedule($shisetsu_id)
    10951102{
    1096     $sql = 'DELETE FROM `biz_shisetsu_schedule` WHERE biz_shisetsu_schedule_id = ?';
     1103    $sql = 'DELETE FROM biz_shisetsu_schedule WHERE biz_shisetsu_schedule_id = ?';
    10971104    $params = array(
    10981105        intval($shisetsu_id),
     
    11141121        $writer_name = '';
    11151122    }
    1116 
     1123   
     1124    if ($due_datetime == '') {
     1125        $due_datetime = '0000-01-01';
     1126    }
     1127   
     1128    if ($biz_group_id == '') {
     1129        $biz_group_id = 0;
     1130    }
     1131   
    11171132    $data = array(
    11181133        'c_member_id' => $member_id,
     
    11461161    }
    11471162   
    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` = ?';
     1163    $sql = 'UPDATE biz_todo SET c_member_id = ?, memo = ?, writer_id = ?,'
     1164        .'r_datetime = ?, due_datetime = ?, priority = ?, biz_group_id = ?,'
     1165        .'public_flag = ? WHERE biz_todo_id = ?';
    11511166
    11521167    $params = array(
     
    11871202    if ($is_check) {
    11881203    //チェックを解除する
    1189         $sql = 'UPDATE `biz_todo` SET `is_check` = \'0\' WHERE `biz_todo_id` = ?';
     1204        $sql = 'UPDATE biz_todo SET is_check = \'0\' WHERE biz_todo_id = ?';
    11901205    } else {
    11911206    //チェックをつける
    1192         $sql = 'UPDATE `biz_todo` SET `is_check` = \'1\' WHERE `biz_todo_id` = ?';
     1207        $sql = 'UPDATE biz_todo SET is_check = \'1\' WHERE biz_todo_id = ?';
    11931208    }
    11941209
     
    12611276function biz_deleteGroupImage($id, $filename)
    12621277{
    1263     $sql = 'UPDATE `biz_group` SET `image_filename` = \'0\' WHERE `biz_group_id` = ?';
     1278    $sql = 'UPDATE biz_group SET image_filename = \'0\' WHERE biz_group_id = ?';
    12641279    $params = array(
    12651280        intval($id),
     
    12711286function biz_deleteShisetsuImage($id, $filename)
    12721287{
    1273     $sql = 'UPDATE `biz_shisetsu` SET `image_filename` = \'0\' WHERE `biz_shisetsu_id` = ?';
     1288    $sql = 'UPDATE biz_shisetsu SET image_filename = \'0\' WHERE biz_shisetsu_id = ?';
    12741289
    12751290    $params = array(
     
    12831298function biz_changeNickname($member_id, $new)
    12841299{
    1285     $sql = 'UPDATE `c_member` SET `nickname` = ? WHERE `c_member_id` = ?';
     1300    $sql = 'UPDATE c_member SET nickname = ? WHERE c_member_id = ?';
    12861301    $params = array(
    12871302        $new,
     
    13031318    biz_deleteShisetsuImage($id, $shisetsu['image_filename']);
    13041319
    1305     $sql = 'DELETE FROM `biz_shisetsu` WHERE biz_shisetsu_id = ?';
     1320    $sql = 'DELETE FROM biz_shisetsu WHERE biz_shisetsu_id = ?';
    13061321    $params = array(
    13071322        intval($id),
Note: See TracChangeset for help on using the changeset viewer.