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


PHP object::fetchAll方法代码示例

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


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

示例1: fetch

 /**
  * Fetch results from PDO statement object
  * @param  object $statement  Prepared PDO statement object
  * @param  string $fetchStyle Style of returned row(s)
  * @return mixed              Returned row(s)
  */
 public function fetch($statement, $fetchStyle)
 {
     if ($fetchStyle === PDO::FETCH_CLASS) {
         return $statement->fetchAll(PDO::FETCH_CLASS, 'stdClass');
     } else {
         return $statement->fetchAll($fetchStyle);
     }
 }
开发者ID:chapmang,项目名称:phpframework,代码行数:14,代码来源:connection.php

示例2: fetchAll

 /**
  * Fetches the results of the executed statement
  * @static
  * @param string $sql A string of the sql query
  * @param array $params An array of the parameter
  * @param int $method The code for the fetch Method to be used, defaulst to FETCH_ASSOC
  * @return array Returns an array of rows from the database
  * @since version 2.0
  */
 public static function fetchAll($sql, $params = array(), $method = PDO::FETCH_ASSOC)
 {
     try {
         return self::execute($sql, $params) ? self::$stmt->fetchAll($method) : false;
     } catch (PDOException $e) {
         return self::pdoException($e);
     }
 }
开发者ID:abrie,项目名称:go-nam-taxi,代码行数:17,代码来源:DB.php

示例3: fetchAll

 public function fetchAll($mode = \PDO::FETCH_ASSOC, $argument = null)
 {
     if ($argument) {
         return $this->statement->fetchAll($mode, $argument);
     } else {
         return $this->statement->fetchAll($mode);
     }
 }
开发者ID:mwyatt,项目名称:core,代码行数:8,代码来源:Pdo.php

示例4: handleRequest

 /**
  * Call this method from the appropriate action method
  *
  * @return ApiProblemResponse|JsonModel
  */
 public function handleRequest()
 {
     $request = $this->getRequest();
     if ($request->getMethod() != $request::METHOD_GET) {
         return new ApiProblemResponse(new ApiProblem(405, 'Only the GET method is allowed for this URI'));
     }
     $model = new JsonModel([$this->property => $this->model->fetchAll()]);
     $model->setTerminal(true);
     return $model;
 }
开发者ID:erik-maas,项目名称:zf-apigility-admin,代码行数:15,代码来源:AbstractPluginManagerController.php

示例5: fetch

 /**
  * method for fetching rows which we created with our query
  * @return array $rows assoc array of rows
  */
 public static function fetch()
 {
     try {
         self::$debug[] = self::$query;
         self::init();
         self::$stmt = self::$dbh->prepare(self::$query);
         self::prepare();
         self::$stmt->execute();
         $rows = self::$stmt->fetchAll(PDO::FETCH_ASSOC);
         if (self::$method == 'select_one') {
             if (!empty($rows)) {
                 $rows = $rows[0];
             }
         }
         self::unsetVars();
     } catch (Exception $e) {
         $message = $e->getTraceAsString();
         log::error($message);
         $last = self::getLastDebug();
         log::error($last);
         die;
     }
     if (self::$method == 'num_rows') {
         return $rows[0]['num_rows'];
     }
     return $rows;
 }
开发者ID:gpawlik,项目名称:suited-php-classes,代码行数:31,代码来源:q.php

示例6: getCol

 /**
  * helper to retrieve sigle column from result
  *
  * @param	string 	the column to be retrieved
  * @return	array	result
  */
 protected function getCol($colName = '')
 {
     $all = $this->statement->fetchAll();
     if (empty($colName)) {
         $colName = key($all[0]);
     }
     return array_column($all, $colName);
 }
开发者ID:visinoiu,项目名称:ReadingLibraryAPI,代码行数:14,代码来源:DB.php

示例7: checkTID

 /**
  * Check for a twitter id in the database
  * @access private
  * @param integer $tid a twitter id(required)
  * @return boolean 
  */	
 private function checkTID($tid) {
     $this->db->setFetchMode(Zend_Db::FETCH_OBJ);
     
     $result = $this->db->fetchAll('SELECT * FROM '.$this->table_name.' WHERE tid = ?', $tid);
     
     return $result;
     
 }
开发者ID:newshorts,项目名称:NFL,代码行数:14,代码来源:process.php

示例8: getTagCount

 /**
  * Get count of all ids in the database - since they're unique this is the total tweets for that hash tag
  * @access public
  * @return object 
  */	
 public function getTagCount() {
     $this->db->setFetchMode(Zend_Db::FETCH_ASSOC);
     
     $result = $this->db->fetchAll('SELECT COUNT(*) as "tweet_count" FROM '.$this->table_name);
     
     return $result[0];
     
 }
开发者ID:newshorts,项目名称:NFL,代码行数:13,代码来源:twitterTracker.php

示例9: _isNotExist

 /**
  * Check existing of hash
  *
  * @static
  * @param string $hash
  * @param object $db
  * @param string $table
  * @return bool
  */
 protected static function _isNotExist($hash, $db, $table)
 {
     $select = $db->select()->from($table)->where('hash=?', $hash);
     $records = $db->fetchAll($select);
     if (empty($records)) {
         return true;
     }
     return false;
 }
开发者ID:nurikk,项目名称:EvilRocketFramework,代码行数:18,代码来源:Imito.php

示例10: renderDefault

 public function renderDefault()
 {
     $this->pager->itemCount = $this->gallery->getCount();
     $this->pager->itemsPerPage = $this->onPage;
     $this->page = $this->pager->getPage();
     $this->template->list = $this->gallery->fetchAll($this->page, $this->onPage, $this->orderBy, $this->sort);
     $this->template->sort = $this->sort;
     $this->template->orderBy = $this->orderBy;
     $this->template->title = $this->documentName;
     if (isset($this->mainSession->filter)) {
         $this['filterForm']->setDefaults($this->mainSession->filter);
     }
     $this->template->showFilter = null;
     //$this->mainSession->filterName;
     $this->template->showSavedFilters = $this->gallery->getSavedFilters();
     $trash = $this->gallery->getTrash();
     $this->template->trashCount = $trash['count'];
     $this->template->trash = $trash['items'];
 }
开发者ID:soundake,项目名称:pd,代码行数:19,代码来源:GalleriesPresenter.php

示例11: result_set

 /**
         This method executes the prepared query
         @access public
  		@throws PDOException object
         @return array or object
 */
 public function result_set()
 {
     try {
         self::execute();
         $result = $this->Stmt->fetchAll(PDO::FETCH_OBJ);
         self::close_cursor();
         return $result;
     } catch (PDOException $e) {
         throw $e;
     }
 }
开发者ID:leandrocurioso,项目名称:php-restful-hmac,代码行数:17,代码来源:PDOHandler.class.php

示例12: getLatestTweet

    /**
     * Get latest tweet from database and output the json
     * @access public
     * @return object 
     */	
    public function getLatestTweet() {
        $this->db->setFetchMode(Zend_Db::FETCH_ASSOC);
        
        $result = $this->db->fetchAll('SELECT profile_img, name, username, text FROM '.$this->table_name.' ORDER BY id DESC LIMIT 1');
        
//        echo '<pre>';
//        print_r($result);
        
        return $result;
        
    }
开发者ID:newshorts,项目名称:NFL,代码行数:16,代码来源:twitterTracker.php

示例13: getAll

 /**
  * 获得所有的查询数据
  * @param string $sql  要执行的SQL指令
  * @param boolean $primkey 是否以主键为下标。使用主键下标,可以返回以数据库主键的值为下标的二维数组
  * @return array 查询得到的数据集,失败返回false
  * @access public
  */
 public function getAll($sql, $primkey = false)
 {
     $this->query($sql);
     if ($primkey) {
         $result = $this->PDOStatement->fetchAll(PDO::FETCH_GROUP | PDO::FETCH_ASSOC);
         $result = array_map('reset', $result);
     } else {
         $result = $this->PDOStatement->fetchAll(PDO::FETCH_ASSOC);
     }
     $this->PDOStatement = null;
     return $result;
 }
开发者ID:weichaoduo,项目名称:zeromore,代码行数:19,代码来源:PdoModel.php

示例14: determineAutoIncrement

 /**
  * determineAutoIncrement()
  * Determines Autoincrement Field if not set
  * @access private
  * @return void
  */
 private function determineAutoIncrement()
 {
     if (!$this->orderByField) {
         $query = "DESCRIBE " . $this->table;
         $result = $this->db->fetchAll($query);
         foreach ($result as $row) {
             if ($row['Extra'] == 'auto_increment') {
                 $this->orderByField = $row['Field'];
             }
         }
     }
 }
开发者ID:reang,项目名称:NG-Framework,代码行数:18,代码来源:Pagination.php

示例15: getFields

 /**
  * Return Table Fields of Requested Table
  * 
  * @param string $sTable
  * @return array Field Type and Field Name
  */
 public function getFields($sTable = '')
 {
     $sSql = "DESC {$sTable};";
     $this->_oSTH = $this->prepare($sSql);
     $this->_oSTH->execute();
     $aColList = $this->_oSTH->fetchAll();
     foreach ($aColList as $key) {
         $aField[] = $key['Field'];
         $aType[] = $key['Type'];
     }
     return array_combine($aField, $aType);
 }
开发者ID:sahartak,项目名称:storage,代码行数:18,代码来源:Database.php


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