Ignore:
Timestamp:
2010/11/06 20:27:45 (16 years ago)
Author:
uchida
Message:

execution time log.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/camp/camp-2_5-D/data/class/SC_Query.php

    r18980 r18990  
    775775     */ 
    776776    function execute(&$sth, $arrVal = array()) { 
     777        $timeStart = SC_Utils_Ex::sfMicrotimeFloat(); 
    777778        $affected =& $sth->execute($arrVal); 
     779 
     780        // 一定以上時間かかったSQLの場合、ログ出力する。 
     781        if(defined('SQL_QUERY_LOG_MODE') && SQL_QUERY_LOG_MODE == true) { 
     782            $timeEnd = SC_Utils_Ex::sfMicrotimeFloat();; 
     783            $timeExecTime = $timeEnd - $timeStart; 
     784            if(defined('SQL_QUERY_LOG_MIN_EXEC_TIME') && $timeExecTime >= (float)SQL_QUERY_LOG_MIN_EXEC_TIME) { 
     785                //$logMsg = sprintf("SQL_LOG [%.2fsec]\n%s", $timeExecTime, $this->getLastQuery(false)); 
     786                $logMsg = sprintf("SQL_LOG [%.2fsec]\n%s", $timeExecTime, $sth->query); 
     787                GC_Utils_Ex::gfPrintLog($logMsg); 
     788            } 
     789        } 
     790 
    778791        if (PEAR::isError($affected)) { 
    779792            $sql = isset($sth->query) ? $sth->query : ''; 
Note: See TracChangeset for help on using the changeset viewer.