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

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

Location:
branches/version-2_12-dev/data/class/pages/admin
Files:
3 edited

Legend:

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

    r21867 r22012  
    144144    function lfUpdPageData($arrUpdData = array()) { 
    145145        $objQuery =& SC_Query_Ex::getSingletonInstance(); 
    146         $sql = ''; 
    147  
    148         // SQL生成 
    149         $sql .= ' UPDATE '; 
    150         $sql .= '     dtb_pagelayout '; 
    151         $sql .= ' SET '; 
    152         $sql .= '     author = ? , '; 
    153         $sql .= '     description = ? , '; 
    154         $sql .= '     keyword = ? '; 
    155         $sql .= ' WHERE '; 
    156         $sql .= '     device_type_id = ? '; 
    157         $sql .= '     AND page_id = ? '; 
    158         $sql .= ' '; 
    159  
    160         // SQL実行 
    161         $ret = $objQuery->query($sql, $arrUpdData); 
    162  
    163         return $ret; 
     146 
     147        $table = 'dtb_pagelayout'; 
     148        $sqlval = array( 
     149            'author'        => $arrUpdData[0], 
     150            'description'   => $arrUpdData[1], 
     151            'keyword'       => $arrUpdData[2], 
     152        ); 
     153        $where = 'device_type_id = ? AND page_id = ?'; 
     154        $arrWhereVal = array( 
     155            $arrUpdData[3], 
     156            $arrUpdData[4], 
     157        ); 
     158 
     159        return $objQuery->update($table, $sqlval, $where, $arrWhereVal); 
    164160    } 
    165161 
  • 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} 
  • branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSVCategory.php

    r21867 r22012  
    528528            $rank = $objQuery->get('rank', 'dtb_category', $where, array($parent_category_id)); 
    529529            // 追加レコードのランク以上のレコードを一つあげる。 
    530             $sqlup = 'UPDATE dtb_category SET rank = (rank + 1) WHERE rank >= ?'; 
    531             $objQuery->exec($sqlup, array($rank)); 
     530            $where = 'rank >= ?'; 
     531            $arrRawSql = array( 
     532                'rank' => '(rank + 1)', 
     533            ); 
     534            $objQuery->update('dtb_category', array(), $where, array($rank), $arrRawSql); 
    532535        } 
    533536 
Note: See TracChangeset for help on using the changeset viewer.