Ignore:
Timestamp:
2012/02/15 19:56:17 (12 years ago)
Author:
Seasoft
Message:

#1625 (typo修正・ソース整形・ソースコメントの改善)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/class/SC_Query.php

    r21490 r21514  
    4747     * @param boolean $new 新規に接続を行うかどうか 
    4848     */ 
    49     function SC_Query($dsn = "", $force_run = false, $new = false) { 
    50  
    51         if ($dsn == "") { 
     49    function SC_Query($dsn = '', $force_run = false, $new = false) { 
     50 
     51        if ($dsn == '') { 
    5252            $dsn = DEFAULT_DSN; 
    5353        } 
     
    9090     * @return SC_Query シングルトンの SC_Query インスタンス 
    9191     */ 
    92     function getSingletonInstance($dsn = "", $force_run = false, $new = false) { 
     92    function getSingletonInstance($dsn = '', $force_run = false, $new = false) { 
    9393        if (!isset($GLOBALS['_SC_Query_instance']) 
    9494            || is_null($GLOBALS['_SC_Query_instance'])) { 
     
    153153     * @return array|null 
    154154     */ 
    155     function select($col, $table, $where = "", $arrWhereVal = array(), $fetchmode = MDB2_FETCHMODE_ASSOC) { 
     155    function select($col, $table, $where = '', $arrWhereVal = array(), $fetchmode = MDB2_FETCHMODE_ASSOC) { 
    156156        $sqlse = $this->getSql($col, $table, $where, $arrWhereVal); 
    157157        return $this->getAll($sqlse, $arrWhereVal, $fetchmode); 
     
    303303            $sqlse .= " WHERE $where"; 
    304304        } elseif (strlen($this->where) >= 1) { 
    305             $sqlse .= " WHERE " . $this->where; 
     305            $sqlse .= ' WHERE ' . $this->where; 
    306306            // 実行時と同じくキャストしてから評価する (空文字を要素1の配列と評価させる意図) 
    307307            $arrWhereValForEval = (array)$arrWhereVal; 
     
    342342        if (is_numeric($limit) && is_numeric($offset)) { 
    343343 
    344             $option = " LIMIT " . $limit; 
    345             $option.= " OFFSET " . $offset; 
     344            $option = ' LIMIT ' . $limit; 
     345            $option.= ' OFFSET ' . $offset; 
    346346            $this->option .= $option; 
    347347        } 
     
    361361            $this->groupby = ''; 
    362362        } else { 
    363             $this->groupby = "GROUP BY " . $str; 
     363            $this->groupby = 'GROUP BY ' . $str; 
    364364        } 
    365365        return $this; 
     
    375375     */ 
    376376    function andWhere($str) { 
    377         if ($this->where != "") { 
    378             $this->where .= " AND " . $str; 
     377        if ($this->where != '') { 
     378            $this->where .= ' AND ' . $str; 
    379379        } else { 
    380380            $this->where = $str; 
     
    392392     */ 
    393393    function orWhere($str) { 
    394         if ($this->where != "") { 
    395             $this->where .= " OR " . $str; 
     394        if ($this->where != '') { 
     395            $this->where .= ' OR ' . $str; 
    396396        } else { 
    397397            $this->where = $str; 
     
    427427            $this->order = ''; 
    428428        } else { 
    429             $this->order = "ORDER BY " . $str; 
     429            $this->order = 'ORDER BY ' . $str; 
    430430        } 
    431431        return $this; 
     
    442442    function setLimit($limit) { 
    443443        if (is_numeric($limit)) { 
    444             $this->option = " LIMIT " .$limit; 
     444            $this->option = ' LIMIT ' .$limit; 
    445445        } 
    446446        return $this; 
     
    457457    function setOffset($offset) { 
    458458        if (is_numeric($offset)) { 
    459             $this->offset = " OFFSET " .$offset; 
     459            $this->offset = ' OFFSET ' .$offset; 
    460460        } 
    461461        return $this; 
     
    480480        foreach ($sqlval as $key => $val) { 
    481481            $strcol .= $key . ','; 
    482             if (strcasecmp("Now()", $val) === 0) { 
     482            if (strcasecmp('Now()', $val) === 0) { 
    483483                $strval .= 'Now(),'; 
    484484            } else if (strcasecmp('CURRENT_TIMESTAMP', $val) === 0) { 
     
    501501            return false; 
    502502        } 
    503         // 文末の","を削除 
     503        // 文末の','を削除 
    504504        $strcol = preg_replace("/,$/", "", $strcol); 
    505505        $strval = preg_replace("/,$/", "", $strval); 
     
    522522     * @return 
    523523     */ 
    524     function update($table, $sqlval, $where = "", $arrWhereVal = array(), $arrRawSql = array(), $arrRawSqlVal = array()) { 
     524    function update($table, $sqlval, $where = '', $arrWhereVal = array(), $arrRawSql = array(), $arrRawSqlVal = array()) { 
    525525        $arrCol = array(); 
    526526        $arrVal = array(); 
     
    528528 
    529529        foreach ($sqlval as $key => $val) { 
    530             if (strcasecmp("Now()", $val) === 0) { 
     530            if (strcasecmp('Now()', $val) === 0) { 
    531531                $arrCol[] = $key . '= Now()'; 
    532532            } else if (strcasecmp('CURRENT_TIMESTAMP', $val) === 0) { 
     
    539539        } 
    540540 
    541         if ($arrRawSql != "") { 
     541        if ($arrRawSql != '') { 
    542542            foreach ($arrRawSql as $key => $val) { 
    543543                $arrCol[] = "$key = $val"; 
     
    551551        } 
    552552 
    553         // 文末の","を削除 
     553        // 文末の','を削除 
    554554        $strcol = implode(', ', $arrCol); 
    555555 
     
    577577     * @return integer MAX文の実行結果 
    578578     */ 
    579     function max($col, $table, $where = "", $arrval = array()) { 
     579    function max($col, $table, $where = '', $arrval = array()) { 
    580580        $ret = $this->get("MAX($col)", $table, $where, $arrval); 
    581581        return $ret; 
     
    591591     * @return integer MIN文の実行結果 
    592592     */ 
    593     function min($col, $table, $where = "", $arrval = array()) { 
     593    function min($col, $table, $where = '', $arrval = array()) { 
    594594        $ret = $this->get("MIN($col)", $table, $where, $arrval); 
    595595        return $ret; 
     
    605605     * @return mixed SQL の実行結果 
    606606     */ 
    607     function get($col, $table, $where = "", $arrWhereVal = array()) { 
     607    function get($col, $table, $where = '', $arrWhereVal = array()) { 
    608608        $sqlse = $this->getSql($col, $table, $where, $arrWhereVal); 
    609609        // SQL文の実行 
     
    652652     * @return array array('カラム名' => '値', ...)の連想配列 
    653653     */ 
    654     function getRow($col, $table, $where = "", $arrWhereVal = array(), $fetchmode = MDB2_FETCHMODE_ASSOC) { 
     654    function getRow($col, $table, $where = '', $arrWhereVal = array(), $fetchmode = MDB2_FETCHMODE_ASSOC) { 
    655655 
    656656        $sql = $this->getSql($col, $table, $where, $arrWhereVal); 
     
    685685     * @return array SQL の実行結果の配列 
    686686     */ 
    687     function getCol($col, $table, $where = "", $arrWhereVal = array()) { 
     687    function getCol($col, $table, $where = '', $arrWhereVal = array()) { 
    688688        $sql = $this->getSql($col, $table, $where, $arrWhereVal); 
    689689        $sql = $this->dbFactory->sfChangeMySQL($sql); 
     
    716716     * @return 
    717717     */ 
    718     function delete($table, $where = "", $arrval = array()) { 
     718    function delete($table, $where = '', $arrval = array()) { 
    719719        if (strlen($where) <= 0) { 
    720720            $sqlde = "DELETE FROM $table"; 
     
    967967     * @return string トレースしたエラー文字列 
    968968     */ 
    969     function traceError($error, $sql = "", $arrVal = false) { 
     969    function traceError($error, $sql = '', $arrVal = false) { 
    970970        $scheme = ''; 
    971971        if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') { 
    972             $scheme = "http://"; 
     972            $scheme = 'http://'; 
    973973        } else { 
    974             $scheme = "https://"; 
     974            $scheme = 'https://'; 
    975975        } 
    976976 
    977977        $err = $scheme . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . "\n\n" 
    978             . "SERVER_ADDR: " . $_SERVER['SERVER_ADDR'] . "\n" 
    979             . "REMOTE_ADDR: " . $_SERVER['REMOTE_ADDR'] . "\n" 
    980             . "USER_AGENT: " . $_SERVER['HTTP_USER_AGENT'] . "\n\n" 
    981             . "SQL: " . $sql . "\n\n"; 
     978            . 'SERVER_ADDR: ' . $_SERVER['SERVER_ADDR'] . "\n" 
     979            . 'REMOTE_ADDR: ' . $_SERVER['REMOTE_ADDR'] . "\n" 
     980            . 'USER_AGENT: ' . $_SERVER['HTTP_USER_AGENT'] . "\n\n" 
     981            . 'SQL: ' . $sql . "\n\n"; 
    982982        if ($arrVal !== false) { 
    983             $err .= "PlaceHolder: " . var_export($arrVal, true) . "\n\n"; 
     983            $err .= 'PlaceHolder: ' . var_export($arrVal, true) . "\n\n"; 
    984984        } 
    985985        $err .= $error->getMessage() . "\n\n"; 
Note: See TracChangeset for help on using the changeset viewer.