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