當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Statement::fetch方法代碼示例

本文整理匯總了PHP中Statement::fetch方法的典型用法代碼示例。如果您正苦於以下問題:PHP Statement::fetch方法的具體用法?PHP Statement::fetch怎麽用?PHP Statement::fetch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Statement的用法示例。


在下文中一共展示了Statement::fetch方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: move

 /**
  * Move: Random access to a specific row in the recordset.
  * Some databases do not support
  * access to previous rows in the databases (no scrolling backwards).
  *
  * @param rowNumber is the row to move to (0-based)
  *
  * @return true if there still rows available,
  *         or false if there are no more rows (EOF).
  */
 public function move($rowNumber = 0)
 {
     $this->EOF = false;
     if ($this->numOfRows > 0 && $rowNumber >= $this->numOfRows) {
         $rowNumber = $this->numOfRows - 2;
         // Overflow to last record
     }
     if ($rowNumber == $this->currentRow) {
         return true;
     }
     if ($this->canSeek) {
         $fields = $this->statement->fetch($rowNumber);
     } else {
         if ($this->bufferedResults === null) {
             $this->bufferedResults = $this->statement->fetchAll();
         }
         $fields = $this->bufferedResults[$rowNumber];
     }
     if ($fields) {
         $this->fields = $fields;
         $this->currentRow = $rowNumber;
         return true;
     }
     $this->fields = false;
     $this->EOF = true;
     return false;
 }
開發者ID:dario1985,項目名稱:adodb,代碼行數:37,代碼來源:ResultSet.php

示例2: __construct

 public function __construct(Statement $statement)
 {
     try {
         $this->crit = $statement->getCriteria();
         if ($this->crit instanceof Criteria) {
             if ($this->crit->action == 'insert') {
                 $this->insert_id = $statement->getInsertID();
             } elseif ($this->crit->action == 'select') {
                 while ($row = $statement->fetch()) {
                     $this->rows[] = new Row($row, $statement);
                 }
                 $this->max_ptr = count($this->rows);
                 $this->int_ptr = 0;
             } elseif ($this->crit->action = 'count') {
                 $value = $statement->fetch();
                 $this->max_ptr = $value['num_col'];
             }
         }
     } catch (\Exception $e) {
         throw $e;
     }
 }
開發者ID:thebuggenie,項目名稱:b2db,代碼行數:22,代碼來源:Resultset.php

示例3: executeLogFindMany

 /**
  * executeLogFindMany
  *
  * Voer een zoekacties op meerdere records uit in de log-tabellen.
  * @param Statement $stmt
  * @return KVDdom_DomainObjectLogCollection
  */
 protected function executeLogFindMany($stmt)
 {
     $stmt->execute();
     $domainObjects = array();
     while ($row = $stmt->fetch(PDO::FETCH_OBJ)) {
         $logObject = $this->doLogLoad($row->id, $row);
         $domainObjects[] = $logObject;
     }
     return new KVDdom_DomainObjectLogCollection($domainObjects);
 }
開發者ID:Tjoosten,項目名稱:kvd,代碼行數:17,代碼來源:KVDdom_PDOLogableDataMapper.class.php


注:本文中的Statement::fetch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。