Ignore:
Timestamp:
Jan 5, 2014, 2:07:44 PM (11 years ago)
Author:
chronos
Message:
  • Added: Print SQL per query duration in developer mode.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/Database.php

    r608 r709  
    6464  function query($Query)
    6565  {
     66        if($this->ShowSQLQuery == true) $QueryStartTime = microtime();
    6667    $this->LastQuery = $Query;
    67     if($this->ShowSQLQuery == true)
    68       echo('<div style="border-bottom-width: 1px; border-bottom-style: solid; padding-bottom: 3px; padding-top: 3px; font-size: 12px; font-family: Arial;">'.$Query.'</div>'."\n");
    6968    if($this->LogSQLQuery == true)
    7069      file_put_contents($this->LogFile, $Query."\n", FILE_APPEND);
    7170    $Result = new DatabaseResult();
    7271    $Result->PDOStatement = $this->PDO->query($Query);
     72    if($this->ShowSQLQuery == true)
     73    {
     74        $Duration = ' ; '.(microtime() - $QueryStartTime). ' s';
     75      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");
     76    }
    7377    if($Result->PDOStatement)
    7478    {
Note: See TracChangeset for help on using the changeset viewer.