예제 #1
0
 public function run()
 {
     if ($this->result !== null && !$this->repeatable) {
         throw new QueryNotRepeatableException('This query has not been marked repeatable.');
     }
     $this->result = $this->mysqli->query($this->sql);
     $this->errno = $this->mysqli->errno;
     $this->error = $this->mysqli->error;
     if ($this->errno > 0) {
         throw ErrorException::findClass($this->mysqli, __LINE__);
     }
 }
예제 #2
0
 public function bindAndExecute(array &$values = null)
 {
     if ($values == null) {
         $values = array();
     }
     $statementValues = array($this->paramTypes);
     foreach ($values as &$value) {
         $statementValues[] =& $value;
     }
     $noParams = count($values);
     if (strlen($this->paramTypes) != $noParams) {
         throw new ParameterCountMismatchException('There is a mismatch between the number of variables to bind and statement variable types.');
     }
     if ($noParams > 0) {
         call_user_func_array(array(&$this->statement, 'bind_param'), $statementValues);
     }
     $this->execute();
     if ($this->mysqli->errno > 0) {
         throw ErrorException::findClass($this->mysqli, __LINE__);
     }
 }