Changeset 21442 for branches/version-2_12-dev/data/class/SC_SelectSql.php
- Timestamp:
- 2012/02/06 11:27:03 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/SC_SelectSql.php
r21441 r21442 50 50 if ($mode == 2) { 51 51 $this->sql .= $this->order; 52 } elseif ( $mode != 1 ){52 } elseif ($mode != 1) { 53 53 $this->sql .= $this->order . " " .$this->limit ." ". $this->offset; 54 54 } … … 67 67 68 68 // ある単位のみ検索($from = $to) 69 if ($from == $to 69 if ($from == $to) { 70 70 $this->setWhere( $column ." = ?" ); 71 71 $return = array($from); 72 72 // ~$toまで検索 73 } elseif (strlen($from) == 0 && strlen($to) > 0 73 } elseif (strlen($from) == 0 && strlen($to) > 0) { 74 74 $this->setWhere( $column ." <= ? "); 75 75 $return = array($to); 76 76 // ~$from以上を検索 77 } elseif (strlen($from) > 0 && strlen($to) == 0 77 } elseif (strlen($from) > 0 && strlen($to) == 0) { 78 78 $this->setWhere( $column ." >= ? "); 79 79 $return = array($from); … … 102 102 103 103 // 開始期間だけ指定の場合 104 if (( $from_year != "" ) && ( $from_month != "" ) && ( $from_day != "" ) && ( $to_year == "" ) && ( $to_month == "" ) && ( $to_day == "" ) 104 if (( $from_year != "" ) && ( $from_month != "" ) && ( $from_day != "" ) && ( $to_year == "" ) && ( $to_month == "" ) && ( $to_day == "" )) { 105 105 $this->setWhere( $column .' >= ?'); 106 106 $return[] = $date1; … … 116 116 117 117 // 終了期間だけ指定の場合 118 if (( $from_year == "" ) && ( $from_month == "" ) && ( $from_day == "" ) && ( $to_year != "" ) && ( $to_month != "" ) && ( $to_day != "" ) 118 if (( $from_year == "" ) && ( $from_month == "" ) && ( $from_day == "" ) && ( $to_year != "" ) && ( $to_month != "" ) && ( $to_day != "" )) { 119 119 $this->setWhere( $column . ' < date(?)'); 120 120 $return[] = $date2; … … 127 127 function setItemTerm( $arr, $ItemStr ) { 128 128 129 foreach ($arr as $data 130 131 if (count( $arr ) > 1 129 foreach ($arr as $data) { 130 131 if (count( $arr ) > 1) { 132 132 if( ! is_null( $data ) ) $item .= $ItemStr . " = ? OR "; 133 133 } else { … … 147 147 $item = " ${ItemStr} IS NULL "; 148 148 149 if ($arr 150 foreach ($arr as $data 149 if ($arr) { 150 foreach ($arr as $data) { 151 151 if ($data != "不明") { 152 152 $item .= " OR ${ItemStr} = ?"; … … 165 165 $item = " ${ItemStr} IS NULL OR ${ItemStr} = '' "; 166 166 $i = 1; 167 if ($arr 168 foreach ($arr as $data 167 if ($arr) { 168 foreach ($arr as $data) { 169 169 if ($i == $count) break; 170 170 $item .= " OR ${ItemStr} = ?"; … … 189 189 $count = count( $arrWhere ); 190 190 191 for ($i = 0; $i < $count; $i++ 191 for ($i = 0; $i < $count; $i++) { 192 192 193 193 if( isset( $arrWhere[$i]['value'] ) ) $statement .= $arrWhere[$i]['column'] ." = " . SC_Utils_Ex::sfQuoteSmart($arrWhere[$i]['value']) ." OR " ; … … 196 196 $statement = "( " . rtrim( $statement, " OR " ) . " )"; 197 197 198 if ($this->where 198 if ($this->where) { 199 199 200 200 $this->where .= " AND " . $statement; … … 208 208 function setWhere($where){ 209 209 if ($where != "") { 210 if ($this->where 210 if ($this->where) { 211 211 212 212 $this->where .= " AND " . $where; … … 233 233 function setLimitOffset( $limit, $offset ){ 234 234 235 if (is_numeric($limit) and is_numeric($offset) 235 if (is_numeric($limit) and is_numeric($offset)) { 236 236 237 237 $this->limit = " LIMIT " .$limit;
Note: See TracChangeset
for help on using the changeset viewer.