[Vtigercrm-commits] [vtiger development] #5386: Missing SQL time log information - PearDatabase.php
vtiger development
vtiger-tickets at trac.vtiger.com
Mon Oct 20 15:03:36 EDT 2008
#5386: Missing SQL time log information - PearDatabase.php
-------------------------+--------------------------------------------------
Reporter: prasad | Owner: developer
Type: defect | Status: new
Priority: unassigned | Milestone: 5.1.0
Component: vtigercrm | Version: 5.0.4
Resolution: | Keywords:
-------------------------+--------------------------------------------------
Comment (by prasad):
Log statements added to function query is given below:
{{{
function query($sql, $dieOnError=false, $msg='')
{
global $log, $default_charset;
//$this->println("ADODB query ".$sql);
$log->debug('query being executed : '.$sql);
$this->checkConnection();
if(strtoupper($default_charset) == 'UTF-8')
$this->database->Execute("SET NAMES utf8");
global $logsqltm;
$sql_start_time = microtime();
$result = & $this->database->Execute($sql);
$sql_end_time = microtime();
// Specifically for timing the SQL execution, you need to enable
DEBUG in log4php.properties
if($logsqltm->isDebugEnabled()){
$sql_start_time = explode(" ", $sql_start_time);
$sql_end_time = explode(" ", $sql_end_time);
$sql_start_time = ((float)$sql_start_time[0] +
(float)$sql_start_time[1]);
$sql_end_time = ((float)$sql_end_time[0] +
(float)$sql_end_time[1]);
$logsqltm->debug("SQL: " . $sql);
if($params != null && count($params) > 0)
$logsqltm->debug("PARAMS: [" . implode(",", $params) . "]");
$logsqltm->debug("EXEC: " . ($sql_end_time -
$sql_start_time) ." micros [START=$sql_start_time, END=$sql_end_time]");
$logsqltm->debug("");
}
$this->lastmysqlrow = -1;
if(!$result)$this->checkError($msg.' Query Failed:' . $sql . '::',
$dieOnError);
return $result;
}
}}}
--
Ticket URL: <http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/5386#comment:1>
vtiger development <http://trac.vtiger.com/>
vtigerCRM
More information about the vtigercrm-commits
mailing list