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