Exemple #1
0
 public static function statusbar()
 {
     if (defined('SAVEQUERIES') && SAVEQUERIES) {
         $logger = new Logger(['identifier' => 'wpdb', 'renderer' => [Connection::instance(), 'renderLog'], 'plural' => 'queries', 'singular' => 'query', 'columns' => ['SQL', 'Duration']]);
         foreach ($GLOBALS['wpdb']->queries as $item) {
             $logger->append($item[0], ['duration' => $item[1]]);
         }
     }
     render(new Template('sledgehammer/mvc/templates/statusbar.php'));
 }
Exemple #2
0
 /**
  * Executes an SQL statement, returning a result set as a PDOStatement object.
  *
  * @link http://php.net/manual/en/pdo.query.php
  *
  * @param string $statement The SQL statement to prepare and execute.
  *
  * @return Statement
  */
 public function query($statement)
 {
     $start = microtime(true);
     $statement = (string) $statement;
     $result = parent::query($statement);
     $this->logger->append($statement, array('duration' => microtime(true) - $start));
     if ($result === false) {
         $this->reportError($statement);
     } else {
         $this->checkWarnings($statement);
     }
     return $result;
 }