Ignore:
Timestamp:
2010/12/19 13:34:00 (14 years ago)
Author:
AMUAMU
Message:

#652 (CSVダウンロードの改善) 商品CSVダウンロード修正。
#582 category_id が末尾に移動される不具合 の解決。
r19742 で発生したWarningの除去

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_5-dev/data/class/db/dbfactory/SC_DB_DBFactory_MYSQL.php

    r19740 r19746  
    7171        // TRUNCをTRUNCATEに変換する 
    7272        $sql = $this->sfChangeTrunc($sql); 
     73        // ARRAY_TO_STRINGをGROUP_CONCATに変換する 
     74        $sql = $this->sfChangeArrayToString($sql); 
    7375        return $sql; 
    7476    } 
     
    276278        return $changesql; 
    277279    } 
    278  
     280     
     281    /** 
     282     * ARRAY_TO_STRING(ARRAY(A),B) を GROUP_CONCAT() に変換する. 
     283     * 
     284     * @access private 
     285     * @param string $sql SQL文 
     286     * @return string 変換後の SQL 文 
     287     */ 
     288    function sfChangeArrayToString($sql){ 
     289        if(stripos($sql, 'ARRAY_TO_STRING') !== FALSE) { 
     290            preg_match_all('/ARRAY_TO_STRING.*?\(.*?ARRAY\(.*?SELECT (.+?) FROM (.+?) WHERE (.+?)\).*?\,.*?\'(.+?)\'.*?\)/is', $sql, $match, PREG_SET_ORDER); 
     291             
     292            foreach($match as $item) { 
     293                $replace = 'GROUP_CONCAT(' . $item[1] . ' SEPARATOR \'' . $item[4] . '\') FROM ' . $item[2] . ' WHERE ' . $item[3]; 
     294                $sql = str_replace($item[0], $replace, $sql); 
     295            } 
     296        } 
     297        return $sql; 
     298    } 
     299     
    279300    /** 
    280301     * WHERE 句置換用の配列を返す. 
Note: See TracChangeset for help on using the changeset viewer.