Exemplo n.º 1
0
 /**
  * prepares a statement
  * 
  * returns the key of the statement
  * 
  * @param string $statement
  * @return int
  */
 public function prepare($statement)
 {
     if (PVars::get()->debug) {
         $tm = microtime();
         PSurveillance::setPoint('statement_prepare' . $tm);
     }
     if (isset($this->result) && $this->result) {
         $this->result->close();
         unset($this->result);
     }
     $statement = $this->_dao->MySQLi->prepare($statement);
     if (!$statement) {
         $e = new PException('Could not prepare statement!', 1000);
         $e->addInfo($this->_dao->getErrNo());
         $e->addInfo($this->_dao->getErrMsg());
         throw $e;
     }
     $this->_statement[] = $statement;
     end($this->_statement);
     $k = key($this->_statement);
     $this->_bound = array();
     if (PVars::get()->debug) {
         PSurveillance::setPoint('eostatement_prepare' . $tm);
     }
     $this->_i = $k;
     return $k;
 }