/**
  * @param string|\Zend\Db\Adapter\StatementContainerInterface $target
  * @return mixed
  */
 public function profilerStart($target)
 {
     $this->queries[] = ['start' => microtime(true), 'end' => null, 'sql' => $target->getSql()];
     if ($this->proxy) {
         call_user_func_array([$this->proxy, 'profilerStart'], func_get_args());
     }
 }
Exemple #2
0
 /**
  * @param string|StatementContainerInterface $target
  * @throws \Zend\Db\Adapter\Exception\InvalidArgumentException
  * @return Profiler
  */
 public function profilerStart($target)
 {
     $profileInformation = array('sql' => '', 'parameters' => null, 'start' => microtime(true), 'end' => null, 'elapse' => null);
     if ($target instanceof StatementContainerInterface) {
         $profileInformation['sql'] = $target->getSql();
         $profileInformation['parameters'] = clone $target->getParameterContainer();
     } elseif (is_string($target)) {
         $profileInformation['sql'] = $target;
     } else {
         throw new Exception\InvalidArgumentException(__FUNCTION__ . ' takes either a StatementContainer or a string');
     }
     $this->profiles[$this->currentIndex] = $profileInformation;
     return $this;
 }