Changeset 21269


Ignore:
Timestamp:
2011/10/02 04:22:08 (9 years ago)
Author:
Seasoft
Message:

#1488 (SC_SelectSql#selectTermRange がプレースホルダを使っていない)
#1449 (不要な関数・処理の整理)

Location:
branches/version-2_11-dev/data/class
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_11-dev/data/class/SC_CustomerList.php

    r21118 r21269  
    213213        if( is_numeric( $this->arrSql["search_buy_total_from"] ) || is_numeric( $this->arrSql["search_buy_total_to"] ) ) { 
    214214            $arrBuyTotal = $this->selectRange($this->arrSql["search_buy_total_from"], $this->arrSql["search_buy_total_to"], "buy_total"); 
    215             foreach ($arrBuyTotal as $data1) { 
    216                 $this->arrVal[] = $data1; 
     215            foreach ($arrBuyTotal as $data) { 
     216                $this->arrVal[] = $data; 
    217217            } 
    218218        } 
     
    223223        if( is_numeric( $this->arrSql["search_buy_times_from"] ) || is_numeric( $this->arrSql["search_buy_times_to"] ) ) { 
    224224            $arrBuyTimes = $this->selectRange($this->arrSql["search_buy_times_from"], $this->arrSql["search_buy_times_to"], "buy_times"); 
    225             foreach ($arrBuyTimes as $data2) { 
    226                 $this->arrVal[] = $data2; 
     225            foreach ($arrBuyTimes as $data) { 
     226                $this->arrVal[] = $data; 
    227227            } 
    228228        } 
     
    240240            $arrBirth = $this->selectTermRange($this->arrSql['search_b_start_year'], $this->arrSql['search_b_start_month'], $this->arrSql['search_b_start_day'] 
    241241                      , $this->arrSql['search_b_end_year'], $this->arrSql['search_b_end_month'], $this->arrSql['search_b_end_day'], 'birth'); 
    242             if (is_array($arrBirth)) { 
    243                 foreach ($arrBirth as $data3) { 
    244                     $this->arrVal[] = $data3; 
    245                 } 
     242            foreach ($arrBirth as $data) { 
     243                $this->arrVal[] = $data; 
    246244            } 
    247245        } 
     
    266264            $arrRegistTime = $this->selectTermRange($this->arrSql['search_start_year'], $this->arrSql['search_start_month'], $this->arrSql['search_start_day'] 
    267265                            , $this->arrSql['search_end_year'], $this->arrSql['search_end_month'], $this->arrSql['search_end_day'], $regdate_col); 
    268             if (is_array($arrRegistTime)) { 
    269                 foreach ($arrRegistTime as $data4) { 
    270                     $this->arrVal[] = $data4; 
    271                 } 
     266            foreach ($arrRegistTime as $data) { 
     267                $this->arrVal[] = $data; 
    272268            } 
    273269        } 
     
    285281            $arrRegistTime = $this->selectTermRange($this->arrSql['search_buy_start_year'], $this->arrSql['search_buy_start_month'], $this->arrSql['search_buy_start_day'] 
    286282                            , $this->arrSql['search_buy_end_year'], $this->arrSql['search_buy_end_month'], $this->arrSql['search_buy_end_day'], "last_buy_date"); 
    287             if (is_array($arrRegistTime)) { 
    288                 foreach ($arrRegistTime as $data4) { 
    289                     $this->arrVal[] = $data4; 
    290                 } 
     283            foreach ($arrRegistTime as $data) { 
     284                $this->arrVal[] = $data; 
    291285            } 
    292286        } 
  • branches/version-2_11-dev/data/class/SC_SelectSql.php

    r20764 r21269  
    8888    //-- 期間検索(○年○月○日か~○年○月○日まで) 
    8989    function selectTermRange($from_year, $from_month, $from_day, $to_year, $to_month, $to_day, $column) { 
     90        $return = array(); 
    9091 
    9192        // 開始期間の構築 
     
    102103        // 開始期間だけ指定の場合 
    103104        if( ( $from_year != "" ) && ( $from_month != "" ) && ( $from_day != "" ) && ( $to_year == "" ) && ( $to_month == "" ) && ( $to_day == "" ) ) { 
    104             $this->setWhere( $column ." >= '" . $date1 . "'"); 
     105            $this->setWhere( $column .' >= ?'); 
     106            $return[] = $date1; 
    105107        } 
    106108 
     
    108110        if( ( $from_year != "" ) && ( $from_month != "" ) && ( $from_day != "" ) && 
    109111            ( $to_year != "" ) && ( $to_month != "" ) && ( $to_day != "" ) ) { 
    110             $this->setWhere( $column ." >= '" . $date1 ."' AND ". $column . " < date('" . $date2 . "')" ); 
     112            $this->setWhere( $column . ' >= ? AND ' . $column . ' < date(?)' ); 
     113            $return[] = $date1; 
     114            $return[] = $date2; 
    111115        } 
    112116 
    113117        // 終了期間だけ指定の場合 
    114118        if( ( $from_year == "" ) && ( $from_month == "" ) && ( $from_day == "" ) && ( $to_year != "" ) && ( $to_month != "" ) && ( $to_day != "" ) ) { 
    115             $this->setWhere( $column ." < date('" . $date2 . "')"); 
    116         } 
     119            $this->setWhere( $column . ' < date(?)'); 
     120            $return[] = $date2; 
     121        } 
     122 
     123        return $return; 
    117124    } 
    118125 
Note: See TracChangeset for help on using the changeset viewer.