コード例 #1
0
ファイル: Connection_Counter.php プロジェクト: atk4/dsql
 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);
 }
コード例 #2
0
ファイル: Connection_Dumper.php プロジェクト: atk4/dsql
 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;
 }