Esempio n. 1
0
 public function execute(Expression $expr)
 {
     if ($expr instanceof Query) {
         $this->queries++;
         if ($expr->mode === 'select' || $expr->mode === null) {
             $this->selects++;
         }
     } else {
         $this->expressions++;
     }
     $ret = parent::execute($expr);
     return $this->iterate($ret);
 }
Esempio n. 2
0
 public function execute(Expression $expr)
 {
     $this->start_time = time() + microtime();
     try {
         $ret = parent::execute($expr);
         $took = time() + microtime() - $this->start_time;
         if ($this->callback) {
             $c = $this->callback;
             $c($expr, $took);
         } else {
             printf("[%02.6f] %s\n", $took, $expr->getDebugQuery());
         }
     } catch (\Exception $e) {
         $took = time() + microtime() - $this->start_time;
         if ($this->callback) {
             $c = $this->callback;
             $c($expr, $took, true);
         } else {
             printf("[ERROR %02.6f] %s\n", $took, $expr->getDebugQuery());
         }
         throw $e;
     }
     return $ret;
 }