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


PHP PDOStatement::closeCursor方法代码示例

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


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

示例1: dispose

 public function dispose()
 {
     if (!$this->is_disposed) {
         $this->statement->closeCursor();
         $this->is_disposed = true;
     }
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:7,代码来源:PDOInjectQueryResult.class.php

示例2: flush

 /**
  * Free memory associated with the resultset
  *
  * @return void
  */
 public function flush()
 {
     if ($this->result instanceof PDOStatement) {
         $this->result->closeCursor();
     }
     $this->result = null;
     $this->col_info = null;
     $this->fetched_rows = array();
 }
开发者ID:mpeshev,项目名称:wp-db-driver,代码行数:14,代码来源:pdo_mysql.php

示例3: found_rows

 /** SELECT FOUND_ROWS() after query with SQL_CALC_FOUND_ROWS
  * @return int
  */
 public function found_rows()
 {
     if (is_null($this->_fr_stmt)) {
         $this->_fr_stmt = $this->prepare('SELECT FOUND_ROWS();');
     }
     $this->_fr_stmt->execute();
     $rows_count = $this->_fr_stmt->fetchColumn(0);
     $this->_fr_stmt->closeCursor();
     return $rows_count;
 }
开发者ID:CCrashBandicot,项目名称:Citadel_1.3.5.1,代码行数:13,代码来源:dbpdo.php

示例4: fetch

 public function fetch()
 {
     $this->executeQuery();
     if ($this->fetchResults === null) {
         $this->fetchResults = $this->statement->fetchAll(PDO::FETCH_ASSOC);
         $this->statement->closeCursor();
     }
     if (array_key_exists($this->currentFetchIndex, $this->fetchResults) && $this->fetchResults[$this->currentFetchIndex] !== null) {
         return $this->fetchResults[$this->currentFetchIndex++];
     }
     return false;
 }
开发者ID:xiaoguizhidao,项目名称:extensiongsd,代码行数:12,代码来源:Statement.php

示例5: query

 /**
  * Run a query against a database.  Get a result
  * @param string $query The SQL to run against the database
  * @param array $args An associative array of query parameters
  * @return bool|\PDOStatement False if query fails, results in this database's fetch_class if successful
  * @throws \Exception
  */
 public function query($query, $args = array())
 {
     if (!empty($this->pdo_statement)) {
         $this->pdo_statement->closeCursor();
     }
     if ($this->pdo_statement = $this->prepare($query, array(PDO::ATTR_EMULATE_PREPARES => true))) {
         $this->pdo_statement->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, $this->fetch_class, [$this]);
         if (!$this->pdo_statement->execute($args)) {
             throw new \Exception($this->pdo_statement->errorInfo());
         }
         return true;
     } else {
         throw new \Exception($this->errorInfo());
     }
 }
开发者ID:ringmaster,项目名称:microsite2,代码行数:22,代码来源:DB.php

示例6: closeCursor

 public function closeCursor()
 {
     if ($this->_statement instanceof \PDOStatement) {
         return $this->_statement->closeCursor();
     }
     return false;
 }
开发者ID:rtshome,项目名称:pgbabylon,代码行数:7,代码来源:PDOStatement.php

示例7: finish

 /**
  * Close the statement handle
  **/
 public function finish()
 {
     if ($this->sh && is_object($this->sh)) {
         $this->sh->closeCursor();
     }
     unset($this->sh);
 }
开发者ID:qbdsoft,项目名称:Query-Digest-UI,代码行数:10,代码来源:pdo.php

示例8: freeResult

 /**
  * Closes the cursor, enabling the statement to be executed again.
  *
  * @return bool Returns true on success, false on failure.
  */
 public function freeResult()
 {
     if ($this->resourceHandle === null) {
         return false;
     }
     $this->resourceHandle->closeCursor();
     return true;
 }
开发者ID:clagiordano,项目名称:weblibs-dbabstraction,代码行数:13,代码来源:PDOAdapter.php

示例9: freeResult

 /**
  * Frees the memory associated with a result.
  * Provides a fluent interface.
  *
  * @return PDOMySQL
  */
 public function freeResult()
 {
     if (isset($this->result)) {
         $this->result->closeCursor();
         unset($this->result);
     }
     return $this;
 }
开发者ID:artoodetoo,项目名称:dbal,代码行数:14,代码来源:PDOMySQL.php

示例10: query

 /**
  * Execute a SQL statement.
  *
  * @param string $query the SQL statement
  * @param array $args values for the bound parameters
  * @return boolean true on success, false on failure
  */
 public function query($query, $args = array())
 {
     if ($this->pdo_statement != null) {
         $this->pdo_statement->closeCursor();
     }
     // Allow plugins to modify the query
     $query = Plugins::filter('query', $query, $args);
     // Translate the query for the database engine
     $query = $this->sql_t($query, $args);
     // Replace braced table names in the query with their prefixed counterparts
     $query = self::filter_tables($query);
     // Allow plugins to modify the query after it has been processed
     $query = Plugins::filter('query_postprocess', $query, $args);
     if ($this->pdo_statement = $this->pdo->prepare($query)) {
         if ($this->fetch_mode == \PDO::FETCH_CLASS) {
             /* Try to get the result class autoloaded. */
             if (!class_exists($this->fetch_class_name, true)) {
                 $class_name = $this->fetch_class_name;
                 // @todo This is a GIANT namespace kludge, replacing Model class names with no namespace that don't exist with a default prefixed class
                 if (strpos($class_name, '\\') == false) {
                     $class_name = '\\Habari\\' . $class_name;
                     $this->fetch_class_name = $class_name;
                     if (!class_exists($this->fetch_class_name, true)) {
                         throw new \Exception('The model class that was specified for data retreival could not be loaded.');
                     }
                 }
             }
             /* Ensure that the class is actually available now, otherwise segfault happens (if we haven't died earlier anyway). */
             if (class_exists($this->fetch_class_name)) {
                 $this->pdo_statement->setFetchMode(\PDO::FETCH_CLASS, $this->fetch_class_name, array());
             } else {
                 /* Die gracefully before the segfault occurs */
                 echo '<br><br>' . _t('Attempt to fetch in class mode with a non-included class') . '<br><br>';
                 return false;
             }
         } else {
             $this->pdo_statement->setFetchMode($this->fetch_mode);
         }
         /* If we are profiling, then time the query */
         if ($this->keep_profile) {
             $profile = new QueryProfile($query);
             $profile->params = $args;
             $profile->start();
         }
         if (!$this->pdo_statement->execute($args)) {
             $this->add_error(array('query' => $query, 'error' => $this->pdo_statement->errorInfo()));
             return false;
         }
         if ($this->keep_profile) {
             $profile->stop();
             $this->profiles[] = $profile;
         }
         return true;
     } else {
         $this->add_error(array('query' => $query, 'error' => $this->pdo->errorInfo()));
         return false;
     }
 }
开发者ID:habari,项目名称:system,代码行数:65,代码来源:databaseconnection.php

示例11: __construct

 /**
  * Hook the result-set given into a Query class, suitable for use by SilverStripe.
  * @param PDOStatement $statement The internal PDOStatement containing the results
  */
 public function __construct(PDOStatement $statement)
 {
     $this->statement = $statement;
     // Since no more than one PDOStatement for any one connection can be safely
     // traversed, each statement simply requests all rows at once for safety.
     // This could be re-engineered to call fetchAll on an as-needed basis
     $this->results = $statement->fetchAll(PDO::FETCH_ASSOC);
     $statement->closeCursor();
 }
开发者ID:ivoba,项目名称:silverstripe-framework,代码行数:13,代码来源:PDOQuery.php

示例12: reset

 protected function reset()
 {
     if ($this->stmt != null) {
         $this->stmt->closeCursor();
     }
     $this->stmt = null;
     $this->resultSet = null;
     $this->updateCount = -1;
 }
开发者ID:robo47,项目名称:BlazeFramework,代码行数:9,代码来源:AbstractStatement.php

示例13: closeCursor

 /**
  * Closes the cursor, allowing the statement to be executed again.
  *
  * @return bool
  * @throws Zend_Db_Statement_Exception
  */
 public function closeCursor()
 {
     try {
         return $this->_stmt->closeCursor();
     } catch (PDOException $e) {
         require_once 'Zend/Db/Statement/Exception.php';
         throw new Zend_Db_Statement_Exception($e->getMessage());
     }
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:15,代码来源:Pdo.php

示例14: close

 /**
  * Close the connection
  */
 public function close()
 {
     // see: http://php.net/manual/en/pdo.connections.php#114822
     if (isset($this->query)) {
         $this->query->closeCursor();
     }
     $this->query = null;
     $this->connection = null;
 }
开发者ID:jesgs,项目名称:greenmvc,代码行数:12,代码来源:Db.php

示例15: beginTransaction

 public function beginTransaction()
 {
     if ($this->transactionNestingLevel == 0 && !$this->db->inTransaction()) {
         if ($this->stmt) {
             $this->stmt->closeCursor();
         }
         $this->db->beginTransaction();
     }
     $this->transactionNestingLevel++;
 }
开发者ID:ashmna,项目名称:LikeTracker,代码行数:10,代码来源:DB.php


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