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


PHP PDOStatement::fetchAll方法代码示例

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


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

示例1: fetchAll

 /**
  * 获取所有
  * @param string $fetchStyle
  * @throws \HuiLib\Error\Exception
  * @return array|object
  */
 public function fetchAll()
 {
     if ($this->innerStatment == NULL) {
         throw new \HuiLib\Error\Exception('fetchAll必须先调用Query::query');
     }
     return $this->innerStatment->fetchAll($this->fetchStyle);
 }
开发者ID:ZhuJingfa,项目名称:HuiLib,代码行数:13,代码来源:Result.php

示例2: rows

 /**
  * Fetches all of the rows returned by the query.
  *
  * @return array
  */
 protected function rows()
 {
     if ($this->rows === null) {
         $this->rows = $this->pdoStatement->fetchAll(PDO::FETCH_ASSOC);
     }
     return $this->rows;
 }
开发者ID:19eighties,项目名称:esoTalk,代码行数:12,代码来源:ETSQLResult.class.php

示例3: findAll

 /**
  * <b>Não é passado com os Joins</b>
  * 
  * @return array[Objetos]
  */
 public function findAll()
 {
     $sql = "SELECT * FROM {$this->Table}";
     $this->Stmt = Conn::prepare($sql);
     $this->Stmt->execute();
     return $this->Stmt->fetchAll();
 }
开发者ID:adrianosilvareis,项目名称:FrameWork_Front,代码行数:12,代码来源:Business.class.php

示例4: fetchAll

 /**
  * @param string $dbObjectName
  *
  * @return array
  */
 public function fetchAll($dbObjectName = '')
 {
     if ('' === $dbObjectName) {
         $dbObjectName = $this->_objectName;
     }
     return $this->_statement->fetchAll(\PDO::FETCH_CLASS | \PDO::FETCH_PROPS_LATE, $dbObjectName);
 }
开发者ID:sclib,项目名称:database,代码行数:12,代码来源:Database.php

示例5: fetchEntities

 /**
  * @param string $entity [null]
  * @return array $entities
  */
 public function fetchEntities($entity = null)
 {
     $entity = $entity ?: $this->entity;
     if (is_null($entity)) {
         $entity = 'stdClass';
     }
     return $this->statement->fetchAll(\PDO::FETCH_CLASS, $entity);
 }
开发者ID:riaf,项目名称:hanasaki,代码行数:12,代码来源:HanasakiStatement.php

示例6: fetchAll

 function fetchAll(PDOStatement $result, $result_type = Database::FETCH_ASSOC, $className = "stdClass", $classArgs = null)
 {
     if ($result_type == self::FETCH_CLASS) {
         $rows = $result->fetchAll($result_type, $className, $classArgs);
     } else {
         $rows = $result->fetchAll($result_type);
     }
     return $rows;
 }
开发者ID:Kalianey,项目名称:kybackup,代码行数:9,代码来源:database.php

示例7: __construct

 /**
  * @param \PDOStatement $statement
  * @param MObject|null $parent
  */
 public function __construct(\PDOStatement $statement, MObject $parent = null)
 {
     parent::__construct($parent);
     $this->statement = $statement;
     $this->rows = $this->statement->fetchAll(\PDO::FETCH_ASSOC);
     $this->fields = empty($this->rows) ? array() : array_keys((array) $this->rows[0]);
     $this->rowCount = count($this->rows);
     $this->columnCount = count($this->fields);
 }
开发者ID:mtoolkit,项目名称:mtoolkit-model,代码行数:13,代码来源:MPDOResult.php

示例8: all

 public function all($param = null, $args = [])
 {
     if (is_callable($param)) {
         return $this->statement->fetchAll(\PDO::FETCH_FUNC, $param);
     }
     if ($param !== null && is_string($param)) {
         $this->bindToClass($param, $args);
     }
     return $this->statement->fetchAll();
 }
开发者ID:shiwolang,项目名称:db,代码行数:10,代码来源:Statement.php

示例9: all

 /**
  * Fetch all results
  * 
  * @param boolean|string $object Fetch as object
  * @return \stdClass[]
  */
 public function all($object = TRUE)
 {
     if ($object) {
         if ($object === TRUE) {
             return $this->stmt->fetchAll(\PDO::FETCH_OBJ);
         }
         return $this->stmt->fetchAll(\PDO::FETCH_CLASS, $object);
     }
     return $this->stmt->fetchAll(\PDO::FETCH_ASSOC);
 }
开发者ID:sugatasei,项目名称:bredala,代码行数:16,代码来源:Result.php

示例10: Execute

 private function Execute()
 {
     $this->Connect();
     try {
         $this->getSyntax();
         $this->read->execute();
         $this->result = $this->read->fetchAll();
     } catch (PDOException $e) {
         echo "<b>Erro ao ler:</b> {$e->getMessage()}";
     }
 }
开发者ID:brenolessa,项目名称:projeto-RI-Br,代码行数:11,代码来源:Read.class.php

示例11: load

 /**
  * {@inheritdoc}
  */
 public function load($locale)
 {
     $parameters = array_merge([$locale], $this->parameters);
     $this->statement->execute($parameters);
     $rows = $this->statement->fetchAll(\PDO::FETCH_NUM);
     $result = [];
     foreach ($rows as $row) {
         $result[$row[0]] = $row[1];
     }
     return $result;
 }
开发者ID:brick,项目名称:brick,代码行数:14,代码来源:PdoLoader.php

示例12: Execute

 private function Execute()
 {
     $this->Connect();
     try {
         $this->getSyntax();
         $this->Read->execute();
         $this->Result = $this->Read->fetchAll();
     } catch (PDOException $e) {
         $this->Result = null;
         WSErro("<b>Erro ao Ler:</b> {$e->getMessage()}", $e->getCode());
     }
 }
开发者ID:jairophp,项目名称:amarmais,代码行数:12,代码来源:Read.php

示例13: 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

示例14: Execute

 private function Execute()
 {
     $this->getCon();
     try {
         $this->setParameters();
         $this->read->execute();
         $this->result = $this->read->fetchAll();
     } catch (PDOException $ex) {
         $this->result = false;
         $erro = 'algo errado...' . $ex->getMessage();
     }
 }
开发者ID:Ritotsume,项目名称:schoolbus,代码行数:12,代码来源:Read.class.php

示例15: __construct

 public function __construct(PDOStatement $stm, $model = null, $fetchMode = PDO::FETCH_OBJ)
 {
     $this->offset = 0;
     if (is_string($model)) {
         $this->rows = $stm->fetchAll(PDO::FETCH_ASSOC);
         $this->model = strtolower(str_ireplace('_model', '', $model));
     } else {
         $this->rows = $stm->fetchAll($fetchMode);
         $this->model = null;
     }
     $this->rowCount = count($this->rows);
 }
开发者ID:hayate,项目名称:hayate,代码行数:12,代码来源:Iterator.php


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