當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。