当前位置: 首页>>代码示例>>PHP>>正文


PHP mysqli_stmt::close方法代码示例

本文整理汇总了PHP中mysqli_stmt::close方法的典型用法代码示例。如果您正苦于以下问题:PHP mysqli_stmt::close方法的具体用法?PHP mysqli_stmt::close怎么用?PHP mysqli_stmt::close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mysqli_stmt的用法示例。


在下文中一共展示了mysqli_stmt::close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: closeCursor

 /**
  * Closes the cursor, allowing the statement to be executed again.
  *
  * @return bool
  */
 public function closeCursor()
 {
     if (!$this->_stmt) {
         return false;
     }
     $this->_stmt->close();
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:ajnet,代码行数:13,代码来源:Mysqli.php

示例2: close

 /**
  * Close the cursor and statement
  *
  * @return Boolean
  */
 public function close()
 {
     if ($this->_stmt) {
         $ret = $this->_stmt->close();
         unset($this->_stmt);
         return $ret;
     }
     return false;
 }
开发者ID:jayzeng,项目名称:dao,代码行数:14,代码来源:Statement.php

示例3: free

 /**
  * 释放资源
  *
  * @return void
  */
 public function free()
 {
     if ($this->prepare instanceof \mysqli_stmt) {
         $this->prepare->close();
         $this->prepare = null;
     }
 }
开发者ID:qazzhoubin,项目名称:emptyphp,代码行数:12,代码来源:MysqlStmt.php

示例4: preparedStatementClose

 public function preparedStatementClose()
 {
     if ($this->stmt) {
         $this->stmt->close();
         $this->stmt = null;
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:7,代码来源:MysqliPreparedStatement.php

示例5: loadDataFromMysqliStatement

 /**
  * Mysqli's binding and returning of statement values
  * Mysqli requires you to bind variables to the extension in order to
  * get data out.  These values have to be references:
  *
  * @see http://php.net/manual/en/mysqli-stmt.bind-result.php
  * @throws Exception\RuntimeException
  * @return bool
  */
 protected function loadDataFromMysqliStatement()
 {
     $data = null;
     // build the default reference based bind structure, if it does not already exist
     if ($this->statementBindValues['keys'] === null) {
         $this->statementBindValues['keys'] = array();
         /* @var $resultResource \mysqli_result */
         $resultResource = $this->resource->result_metadata();
         foreach ($resultResource->fetch_fields() as $col) {
             $this->statementBindValues['keys'][] = $col->name;
         }
         $this->statementBindValues['values'] = array_fill(0, count($this->statementBindValues['keys']), null);
         $refs = array();
         foreach ($this->statementBindValues['values'] as $i => &$f) {
             $refs[$i] =& $f;
         }
         call_user_func_array(array($this->resource, 'bind_result'), $this->statementBindValues['values']);
     }
     if (($r = $this->resource->fetch()) === null) {
         if (!$this->isBuffered) {
             $this->resource->close();
         }
         return false;
     } elseif ($r === false) {
         throw new Exception\RuntimeException($this->resource->error);
     }
     // dereference
     for ($i = 0, $count = count($this->statementBindValues['keys']); $i < $count; $i++) {
         $this->currentData[$this->statementBindValues['keys'][$i]] = $this->statementBindValues['values'][$i];
     }
     $this->currentComplete = true;
     $this->nextComplete = true;
     $this->position++;
     return true;
 }
开发者ID:musicsnap,项目名称:Yaf.Global.Library,代码行数:44,代码来源:Result.php

示例6: executar

 /**
  * executar
  * Recebe os dados, monta o bind_param e executa.
  * 
  * @param array
  * @throws Exception
  */
 protected function executar(array $dados)
 {
     /** @var array */
     $params = $this->prepararDados($dados);
     /** Passa os paramentros ao bind_param */
     if (count($dados) > 0) {
         if ($this->stmt) {
             call_user_func_array(array($this->stmt, 'bind_param'), $this->makeValuesReferenced($params));
         } else {
             throw new Exception("Erro ao executar \"{$this->mysqli->error}\"", $this->mysqli->errno);
         }
     }
     /** Executa a consulta e verifica se ocorreu algum erro */
     if (!$this->stmt->execute()) {
         throw new Exception("Erro ao executar: (" . $this->stmt->error . ") ", $this->stmt->errno);
     }
     /** Preenche o array de dados caso haja algum retorno */
     $this->result = array();
     $r = $this->stmt->get_result();
     if ($r) {
         while ($row = $r->fetch_assoc()) {
             $this->result[] = $row;
         }
     }
     /** Fecha o stamtment e a conexao com o banco */
     $this->stmt->close();
     $this->mysqli->close();
 }
开发者ID:Giselly,项目名称:AVAWEB_Responsivo,代码行数:35,代码来源:ConexaoDAO.class.php

示例7: close

 /**
  * Closes the cursor and the statement.
  *
  * @return bool
  */
 public function close()
 {
     if ($this->_stmt) {
         $r = $this->_stmt->close();
         $this->_stmt = null;
         return $r;
     }
     return false;
 }
开发者ID:hizamomar,项目名称:dropship,代码行数:14,代码来源:Mysqli.php

示例8: freeResult

 /**
  * Method to free up the memory used for the result set.
  *
  * @param   mixed  $cursor  The optional result set cursor from which to fetch the row.
  *
  * @return  void
  *
  * @since   1.0
  */
 protected function freeResult($cursor = null)
 {
     $this->executed = false;
     if ($cursor instanceof \mysqli_result) {
         $cursor->free_result();
     }
     if ($this->prepared instanceof \mysqli_stmt) {
         $this->prepared->close();
         $this->prepared = null;
     }
 }
开发者ID:jbanety,项目名称:database,代码行数:20,代码来源:MysqliDriver.php

示例9: close

 /**
  * 
  * 关闭 stmt result mysqli的函数,传入这三个东西就行
  * @param mysqli,stmt,result
  */
 static function close(mysqli $mysqli = null, mysqli_stmt $stmt = null, mysqli_result $result = null)
 {
     if ($result != null) {
         $result->free();
     }
     if ($stmt != null) {
         $stmt->close();
     }
     if ($mysqli != null) {
         $mysqli->close();
     }
 }
开发者ID:reducm,项目名称:JASEnglish,代码行数:17,代码来源:db.class.php

示例10: _cleanup

 /**
  * Clean up all vars
  */
 private function _cleanup()
 {
     $this->_select = array();
     $this->_target = "";
     //$this->_query_string 	= "";
     $this->_where = array();
     $this->_bind_params = array('');
     $this->_joins = array();
     $this->_limit = array();
     $this->_orderBy = array();
     $this->_query->close();
 }
开发者ID:NightWingStudios,项目名称:Nightshade,代码行数:15,代码来源:Query.php

示例11: caricaIndirizzoDaStmt

 /**
  * Carica un indirizzo eseguendo un prepared statement
  * @param mysqli_stmt $stmt
  * @return null
  */
 public function caricaIndirizzoDaStmt(mysqli_stmt $stmt)
 {
     if (!$stmt->execute()) {
         error_log("[caricaIndirizzoDaStmt] impossibile" . " eseguire lo statement");
         return null;
     }
     $row = array();
     $bind = $stmt->bind_result($row['id'], $row['destinatario'], $row['via_num'], $row['citta'], $row['provincia'], $row['cap'], $row['telefono']);
     if (!$bind) {
         error_log("[caricaIndirizzoDaStmt] impossibile" . " effettuare il binding in output");
         return null;
     }
     if (!$stmt->fetch()) {
         return null;
     }
     $stmt->close();
     return self::creaIndirizzoDaArray($row);
 }
开发者ID:Artorias91,项目名称:Progetto-AMM,代码行数:23,代码来源:IndirizzoFactory.php

示例12: fetchAll

 /**
  * @return array
  * @throws \Exception
  */
 public function fetchAll()
 {
     $results = [$this->translator->trans('sorry', array(), 'messages'), $this->translator->trans('wrong_query_execution', array(), 'messages')];
     do {
         if (isset($this->connection->field_count) && !$this->connection->field_count) {
             if (strlen($this->connection->error) > 0) {
                 $error = $this->connection->error;
                 if ($this->connection->errno === 2014) {
                     // Repair all tables of the test database
                     $this->logger->error('[CONNECTION] ' . $error);
                 } else {
                     $this->logger->info('[CONNECTION] ' . $error);
                 }
                 throw new \Exception($error);
             } else {
                 $this->lastResults = self::RESULTS_NONE;
                 $results[1] = $this->translator->trans('no_record', array(), 'messages');
                 if (!is_null($this->statement) && $this->statement instanceof \mysqli_stmt) {
                     /**
                      * @see http://stackoverflow.com/a/25377031/2820730 about using \mysqli and xdebug
                      */
                     $this->statement->close();
                     unset($this->statement);
                 }
             }
         } else {
             $queryResult = $this->lastResults;
             /**
              * @var \mysqli_result $queryResult
              */
             if (is_object($queryResult) && $queryResult instanceof \mysqli_result) {
                 $results = [];
                 while ($result = $queryResult->fetch_array(MYSQLI_ASSOC)) {
                     if (!is_null($result)) {
                         $results[] = $result;
                     }
                 }
             }
         }
         $this->queryCount--;
     } while ($this->queryCount > 0);
     return $results;
 }
开发者ID:WeavingTheWeb,项目名称:devobs,代码行数:47,代码来源:Connection.php

示例13: array

 /**
  * Carica una lista di articoli eseguendo un prepared statement
  * @param mysqli_stmt $stmt
  * @return null
  */
 public function &caricaArticoliDaStmt(mysqli_stmt $stmt)
 {
     $articoli = array();
     if (!$stmt->execute()) {
         error_log("[caricaArticoliDaStmt] impossibile" . " eseguire lo statement");
         return null;
     }
     $row = array();
     $bind = $stmt->bind_result($row['id'], $row['size'], $row['qty'], $row['prezzo'], $row['pizza_id']);
     if (!$bind) {
         error_log("[caricaArticoliDaStmt] impossibile" . " effettuare il binding in output");
         return null;
     }
     while ($stmt->fetch()) {
         $articoli[] = self::creaArticoloDaArray($row);
     }
     $stmt->close();
     return $articoli;
 }
开发者ID:Artorias91,项目名称:Progetto-AMM,代码行数:24,代码来源:ArticoloFactory.php

示例14: executeAndFetch

 function executeAndFetch($className = self::DEFAULT_CLASS_NAME, $type = self::RESULT_OBJECT, array $iteratorMap = null)
 {
     try {
         $this->execute();
     } catch (\Exception $ex) {
         throw $ex;
     }
     switch ($type) {
         case self::RESULT_OBJECT:
             $objectBuilder = $className != self::DEFAULT_CLASS_NAME ? new ObjectBuilderUtil($className) : null;
             return $this->fetchObject($className, $objectBuilder, $iteratorMap);
         case self::RESULT_ARRAY:
             return $this->fetchArray($iteratorMap);
         default:
             throw new \InvalidArgumentException('Invalid Return Type');
     }
     $this->stmt->free_result();
     if (!$this->reusable) {
         $this->stmt->close();
         unset($this->stmt);
     } else {
         $this->stmt->reset();
     }
 }
开发者ID:laiello,项目名称:perminator,代码行数:24,代码来源:MysqliPrepareStmt.php

示例15: caricaAdminDaStmt

 /**
  * Carica un docente eseguendo un prepared statement
  * @param mysqli_stmt $stmt
  * @return null
  */
 private function caricaAdminDaStmt(mysqli_stmt $stmt)
 {
     if (!$stmt->execute()) {
         error_log("[caricaAdminDaStmt] impossibile" . " eseguire lo statement");
         return null;
     }
     $row = array();
     $bind = $stmt->bind_result($row['admin_id'], $row['admin_username'], $row['admin_password'], $row['admin_nome'], $row['admin_cognome'], $row['admin_via'], $row['admin_civico'], $row['admin_cap'], $row['admin_citta'], $row['admin_telefono']);
     if (!$bind) {
         error_log("[caricaAdminDaStmt] impossibile" . " effettuare il binding in output");
         return null;
     }
     if (!$stmt->fetch()) {
         return null;
     }
     $stmt->close();
     return self::creaAdminDaArray($row);
 }
开发者ID:headlessdoll,项目名称:Amm2015,代码行数:23,代码来源:UserFactory.php


注:本文中的mysqli_stmt::close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。