Esempio n. 1
0
 /**
  * Execute the statement
  *
  * @access public
  */
 public function execute()
 {
     parent::execute();
     if ($this->errno > 0) {
         throw new \Exception($this->error);
     }
 }
 /**
  * Executes query, measures the total time
  * @param null $input_parameters
  * @return $this for fluent interface
  */
 public function execute($sqlValues = array())
 {
     $this->result = null;
     $start = microtime(true);
     if ($sqlValues) {
         $this->bindValues($sqlValues);
     }
     if (preg_match('#:([a-zA-Z0-9_]+)#', $this->queryString)) {
         $this->queryString = preg_replace('#:([a-zA-Z0-9_]+)#', '?', $this->queryString);
     }
     if ($this->boundValues) {
         $tmp = array();
         foreach ($this->boundValues as $key => $value) {
             $tmp[$key] =& $this->boundValues[$key];
         }
         array_unshift($tmp, join('', $this->boundValuesTypes));
         @call_user_func_array(array($this, 'bind_param'), $tmp);
     }
     $this->getLink()->setLatestStmt($this);
     @parent::execute();
     $end = microtime(true);
     $this->duration = round($end - $start, 4);
     $this->totalDuration += $this->duration;
     $this->executed = true;
     $this->execCount++;
     $this->preview = null;
     if ($this->error) {
         throw MysqliException::factory($this->error, $this->errno, null, $this);
     }
     return $this;
 }