Ignore:
Timestamp:
2012/08/30 14:15:56 (12 years ago)
Author:
shutta
Message:

refs #1925 (SC_Queryのupdateメソッドの使用を推奨)
SC_Queryのupdateメソッドを使用するように書き換えた。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Category.php

    r21867 r22012  
    469469            $rank = $objQuery->get('rank', 'dtb_category', $where, array($parent_category_id)); 
    470470            // 追加レコードのランク以上のレコードを一つあげる。 
    471             $sqlup = 'UPDATE dtb_category SET rank = (rank + 1) WHERE rank >= ?'; 
    472             $objQuery->exec($sqlup, array($rank)); 
     471            $where = 'rank >= ?'; 
     472            $arrRawSql = array( 
     473                'rank' => '(rank + 1)', 
     474            ); 
     475            $objQuery->update('dtb_category', array(), $where, array($rank), $arrRawSql); 
    473476        } 
    474477 
     
    564567        $arrRet = $objDb->sfGetChildrenArray($table, $pid_name, $id_name, $id); 
    565568        $line = SC_Utils_Ex::sfGetCommaList($arrRet); 
    566         $sql = "UPDATE $table SET rank = (rank + $count) WHERE $id_name IN ($line) "; 
    567         $sql.= 'AND del_flg = 0'; 
    568         $ret = $objQuery->exec($sql); 
    569         return $ret; 
     569        $where = "$id_name IN ($line) AND del_flg = 0"; 
     570        $arrRawVal = array( 
     571            'rank' => "(rank + $count)", 
     572        ); 
     573        return $objQuery->update($table, array(), $where, array(), $arrRawVal); 
    570574    } 
    571575 
     
    575579        $arrRet = $objDb->sfGetChildrenArray($table, $pid_name, $id_name, $id); 
    576580        $line = SC_Utils_Ex::sfGetCommaList($arrRet); 
    577         $sql = "UPDATE $table SET rank = (rank - $count) WHERE $id_name IN ($line) "; 
    578         $sql.= 'AND del_flg = 0'; 
    579         $ret = $objQuery->exec($sql); 
    580         return $ret; 
     581        $where = "$id_name IN ($line) AND del_flg = 0"; 
     582        $arrRawVal = array( 
     583            'rank' => "(rank - $count)", 
     584        ); 
     585        return $objQuery->update($table, array(), $where, array(), $arrRawVal); 
    581586    } 
    582587} 
Note: See TracChangeset for help on using the changeset viewer.