当前位置: 首页>>代码示例>>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;未经允许,请勿转载。