Ignore:
Timestamp:
Jan 31, 2014, 12:23:31 AM (11 years ago)
Author:
chronos
Message:
  • Added: Log query duration to sql log file.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/Database.php

    r765 r769  
    6363  function query($Query)
    6464  {
    65         if($this->ShowSQLQuery == true) $QueryStartTime = microtime();
     65        if(($this->ShowSQLQuery == true) or ($this->LogSQLQuery == true)) $QueryStartTime = microtime();
    6666    $this->LastQuery = $Query;
    67     if($this->LogSQLQuery == true)
    68       file_put_contents($this->LogFile, $Query."\n", FILE_APPEND);
    6967    $Result = new DatabaseResult();
    7068    $Result->PDOStatement = $this->PDO->query($Query);
     69    if(($this->ShowSQLQuery == true) or ($this->LogSQLQuery == true))
     70      $Duration = ' ; '.(microtime() - $QueryStartTime). ' s';
     71    if($this->LogSQLQuery == true)
     72      file_put_contents($this->LogFile, $Query.$Duration."\n", FILE_APPEND);
    7173    if($this->ShowSQLQuery == true)
    72     {
    73         $Duration = ' ; '.(microtime() - $QueryStartTime). ' s';
    7474      echo('<div style="border-bottom-width: 1px; border-bottom-style: solid; padding-bottom: 3px; padding-top: 3px; font-size: 12px; font-family: Arial;">'.$Query.$Duration.'</div>'."\n");
    75     }
    7675    if($Result->PDOStatement)
    7776    {
Note: See TracChangeset for help on using the changeset viewer.