Ignore:
Timestamp:
2007/03/11 06:27:25 (19 years ago)
Author:
nanasess
Message:

r11729 の変更を取消

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/comu/data/class/SC_SelectSql.php

    r11729 r11730  
    66 */ 
    77 
    8 /* ---- SQL文を作るクラス ---- */ 
     8/* ---- SQLʸ¤òºî¤ë¥¯¥é¥¹ ---- */ 
    99class SC_SelectSql { 
    1010     
     
    2020    var $arrVal; 
    2121 
    22     //-- コンストラクタ。 
     22    //--¡¡¥³¥ó¥¹¥È¥é¥¯¥¿¡£ 
    2323    function SC_SelectSql($array = "") { 
    2424        if (is_array($array)) { 
     
    2727    } 
    2828 
    29     //-- SQL分生成 
     29    //-- SQLʬÀ¸À® 
    3030    function getSql( $mode = "" ){ 
    3131        $this->sql = $this->select ." ". $this->where ." ". $this->group ." "; 
    3232                         
    33         // $mode == 1 は limit & offset無し                         
     33        // $mode == 1 ¤Ï limit & offset̵¤·                      
    3434        if ( $mode != 1 ){ 
    3535            $this->sql .= $this->order . " " .$this->limit ." ". $this->offset;  
     
    4040    } 
    4141 
    42         // 検索用 
     42        // ¸¡º÷ÍÑ 
    4343    function addSearchStr($val) { 
    4444        $return = sfManualEscape($val); 
     
    4747    } 
    4848     
    49     //-- 範囲検索(○ ~ ○ まで) 
     49    //-- Èϰϸ¡º÷¡Ê¡û¡¡¢·¡¡¡û¡¡¤Þ¤Ç¡Ë 
    5050    function selectRange($from, $to, $column) { 
    5151 
    52         // ある単位のみ検索($from = $to) 
     52        // ¤¢¤ëñ°Ì¤Î¤ß¸¡º÷($from = $to) 
    5353        if(  $from == $to ) { 
    5454            $this->setWhere( $column ." = ?" ); 
    5555            $return = array($from); 
    56         // ~$toまで検索 
     56        //¡¡¢·$to¤Þ¤Ç¸¡º÷ 
    5757        } elseif(  strlen($from) == 0 && strlen($to) > 0 ) { 
    5858            $this->setWhere( $column ." <= ? ");  
    5959            $return = array($to); 
    60         // ~$from以上を検索 
     60        //¡¡¢·$from°Ê¾å¤ò¸¡º÷ 
    6161        } elseif(  strlen($from) > 0 && strlen($to) == 0 ) { 
    6262            $this->setWhere( $column ." >= ? "); 
    6363            $return = array($from); 
    64         // $from~$toの検索 
     64        //¡¡$from¢·$to¤Î¸¡º÷ 
    6565        } else { 
    6666            $this->setWhere( $column ." BETWEEN ? AND ?" );  
     
    7070    } 
    7171 
    72     //-- 期間検索(○年○月○日か~○年○月○日まで) 
     72    //--¡¡´ü´Ö¸¡º÷¡Ê¡ûǯ¡û·î¡ûÆü¤«¢·¡ûǯ¡û·î¡ûÆü¤Þ¤Ç¡Ë 
    7373    function selectTermRange($from_year, $from_month, $from_day, $to_year, $to_month, $to_day, $column) { 
    7474 
     
    8181        $date2 = date('y/m/d', $date2); 
    8282         
    83         // 開始期間だけ指定の場合 
     83        // ³«»Ï´ü´Ö¤À¤±»ØÄê¤Î¾ì¹ç 
    8484        if( ( $from_year != "" ) && ( $from_month != "" ) && ( $from_day != "" ) && ( $to_year == "" ) && ( $to_month == "" ) && ( $to_day == "" ) ) { 
    8585            $this->setWhere( $column ." >= '" . $date1 . "'"); 
    8686        } 
    8787 
    88         // 開始〜終了 
     88        //¡¡³«»Ï¡Á½ªÎ» 
    8989        if( ( $from_year != "" ) && ( $from_month != "" ) && ( $from_day != "" ) &&  
    9090            ( $to_year != "" ) && ( $to_month != "" ) && ( $to_day != "" ) ) { 
     
    9292        } 
    9393 
    94         // 終了期間だけ指定の場合 
     94        // ½ªÎ»´ü´Ö¤À¤±»ØÄê¤Î¾ì¹ç 
    9595        if( ( $from_year == "" ) && ( $from_month == "" ) && ( $from_day == "" ) && ( $to_year != "" ) && ( $to_month != "" ) && ( $to_day != "" ) ) { 
    9696            $this->setWhere( $column ." < date('" . $date2 . "')"); 
     
    9999    }    
    100100 
    101     // checkboxなどで同一カラム内で単一、もしくは複数選択肢が有る場合 例: AND ( sex = xxx OR sex = xxx OR sex = xxx  ) AND ...  
     101    // checkbox¤Ê¤É¤ÇƱ°ì¥«¥é¥àÆâ¤Çñ°ì¡¢¤â¤·¤¯¤ÏÊ£¿ôÁªÂò»è¤¬Í­¤ë¾ì¹ç¡¡Îã: AND ( sex = xxx OR sex = xxx OR sex = xxx  ) AND ...  
    102102    function setItemTerm( $arr, $ItemStr ) { 
    103103 
     
    117117    } 
    118118 
    119     // NULL値が必要な場合 
     119    //¡¡NULLÃͤ¬É¬Íפʾì¹ç 
    120120    function setItemTermWithNull( $arr, $ItemStr ) { 
    121121 
     
    124124        if ( $arr ){ 
    125125            foreach( $arr as $data ) {   
    126                 if ($data != "不明") { 
     126                if ($data != "ÉÔÌÀ") { 
    127127                    $item .= " OR ${ItemStr} = ?"; 
    128128                    $return[] = $data; 
     
    135135        return $return; 
    136136    } 
    137     // NULLもしくは''で検索する場合 
     137    // NULL¤â¤·¤¯¤Ï''¤Ç¸¡º÷¤¹¤ë¾ì¹ç 
    138138    function setItemTermWithNullAndSpace( $arr, $ItemStr ) { 
    139139        $count = count($arr); 
     
    155155 
    156156 
    157     /* 複数のカラムでORで優先検索する場合 例: AND ( item_flag1 = xxx OR item_flag2 = xxx OR item_flag3 = xxx  ) AND ...  
    158  
    159         配列の構造例  
     157    /* Ê£¿ô¤Î¥«¥é¥à¤ÇOR¤ÇÍ¥À踡º÷¤¹¤ë¾ì¹ç¡¡Îã¡§¡¡AND ( item_flag1 = xxx OR item_flag2 = xxx OR item_flag3 = xxx  ) AND ...  
     158 
     159        ÇÛÎó¤Î¹½Â¤Îã¡¡ 
    160160        if ( $_POST['show_site1'] ) $arrShowsite_1 = array( "column" => "show_site1", 
    161161                                                            "value"  => $_POST['show_site1'] ); 
Note: See TracChangeset for help on using the changeset viewer.