當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PDOStatement::fetchObject方法代碼示例

本文整理匯總了PHP中PDOStatement::fetchObject方法的典型用法代碼示例。如果您正苦於以下問題:PHP PDOStatement::fetchObject方法的具體用法?PHP PDOStatement::fetchObject怎麽用?PHP PDOStatement::fetchObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PDOStatement的用法示例。


在下文中一共展示了PDOStatement::fetchObject方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: next

 /**
  * Fetch next result
  * 
  * @param boolean|string $object Fetch as object
  * @return \stdClass
  */
 public function next($object = TRUE)
 {
     if ($object) {
         if ($object === TRUE) {
             return $this->stmt->fetchObject();
         }
         return $this->stmt->fetchObject($object);
     }
     return $this->stmt->fetch(\PDO::FETCH_ASSOC);
 }
開發者ID:sugatasei,項目名稱:bredala,代碼行數:16,代碼來源:Result.php

示例2: fetch

 public function fetch($class = null)
 {
     if (!$this->result) {
         throw new Exception('Can\'t fetch result if no query!');
     }
     return $class === false ? $this->result->fetch(PDO::FETCH_ASSOC) : $this->result->fetchObject($class ?: self::config('fetch'));
 }
開發者ID:phanngoc,項目名稱:mvc_ttap_laravel,代碼行數:7,代碼來源:Db.php

示例3: fetchObject

 /**
  * {@inheritdoc}
  *
  * @throws \Orno\Db\Exception\NoResourceException
  */
 public function fetchObject()
 {
     if (!$this->statement instanceof \PDOStatement) {
         throw new Exception\NoResourceException(sprintf('%s expects a query to have been prepared and executed', __METHOD__));
     }
     return $this->statement->fetchObject();
 }
開發者ID:orno,項目名稱:db,代碼行數:12,代碼來源:Pdo.php

示例4: getMinimumValue

 /**
  * @param \PDOStatement $statement
  *
  * @return \MongoId
  */
 protected function getMinimumValue(\PDOStatement $statement)
 {
     $result = $statement->fetchObject();
     if (!isset($result) || !isset($result->minimum)) {
         return;
     }
     return new \MongoId($result->minimum);
 }
開發者ID:antimattr,項目名稱:etl,代碼行數:13,代碼來源:PDOMaximumColumnObjectIdExtractor.php

示例5: fetchObject

 /**
  * 獲得結果集中的下一行,同時根據設置的類返回如果沒有設置則返回的使StdClass對象
  * 
  * @param string $className  使用的類
  * @param array $ctor_args   初始化參數
  * @return object
  */
 public function fetchObject($className = '', $ctor_args = array())
 {
     if ($className === '') {
         return $this->_statement->fetchObject();
     } else {
         return $this->_statement->fetchObject($className, $ctor_args);
     }
 }
開發者ID:jellycheng,項目名稱:windframework,代碼行數:15,代碼來源:WindResultSet.php

示例6: treat_success

 /** @param PDOStatement $query_result */
 private function treat_success($query_result)
 {
     $result_array = array();
     while ($query_obj = $query_result->fetchObject()) {
         $result_array[] = $query_obj;
     }
     parent::set_result('result_array', $result_array);
 }
開發者ID:thalelinh,項目名稱:MoneyManager,代碼行數:9,代碼來源:Select_invitations_from_user.class.php

示例7: fetch

 protected static function fetch(\PDOStatement $result)
 {
     $out = array();
     while ($record = $result->fetchObject(get_called_class())) {
         $out[] = $record;
     }
     return $out;
 }
開發者ID:finalclass,項目名稱:nbml,代碼行數:8,代碼來源:Model.php

示例8: getMinimumValue

 /**
  * @param \PDOStatement $statement
  *
  * @return mixed $value
  */
 protected function getMinimumValue(\PDOStatement $statement)
 {
     $result = $statement->fetchObject();
     if (!isset($result) || !isset($result->minimum)) {
         return $this->defaultValue;
     }
     return $result->minimum;
 }
開發者ID:antimattr,項目名稱:etl,代碼行數:13,代碼來源:PDOMaximumColumnExtractor.php

示例9: fetchObject

 /**
  * Return the current rowset as an object with columns set as members of the object.
  *
  * @param string $className OPTIONAL: The class of the object returned,
  *                          defaults to 'stdClass'
  * @param array $args       OPTIONAL: Arguments to pass the the class constructor.
  * @return object
  */
 public function fetchObject($className = 'stdClass', $args = array())
 {
     try {
         return $this->_stmt->fetchObject($className, $args);
     } catch (PDOException $e) {
         throw new DBALite_Exception("Error fetching row from result set", $e);
     }
 }
開發者ID:paulyg,項目名稱:dbalite,代碼行數:16,代碼來源:Statement.php

示例10: fetch

 function fetch(PDOStatement $result, $result_type = Database::FETCH_ASSOC, $className = "stdClass", $classArgs = null)
 {
     if ($result_type == self::FETCH_CLASS) {
         $row = $result->fetchObject($className, $classArgs);
     } else {
         $row = $result->fetch($result_type);
     }
     return $row;
 }
開發者ID:Kalianey,項目名稱:kybackup,代碼行數:9,代碼來源:database.php

示例11: asObject

 /**
  * Returns query result as an object based on the name of the called class.
  *
  * @param PDOStatement $q
  *
  * @return Model $object 
  */
 private static function asObject($q, $getFkAsObject)
 {
     while ($object = $q->fetchObject(get_called_class())) {
         if ($getFkAsObject) {
             self::getFkAsObject($object);
         }
         return $object;
     }
 }
開發者ID:gaetanm,項目名稱:caphpy,代碼行數:16,代碼來源:Model.class.php

示例12: fetchObject

 /**
  * Fetches the next row and returns it as an object.
  *
  * @param string $class  OPTIONAL Name of the class to create.
  * @param array  $config OPTIONAL Constructor arguments for the class.
  * @return mixed One object instance of the specified class.
  * @throws Zend_Db_Statement_Exception
  */
 public function fetchObject($class = 'stdClass', array $config = array())
 {
     try {
         return $this->_stmt->fetchObject($class, $config);
     } catch (PDOException $e) {
         require_once 'Zend/Db/Statement/Exception.php';
         throw new Zend_Db_Statement_Exception($e->getMessage());
     }
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:17,代碼來源:Pdo.php

示例13: single

 /**
  * Executes statement and returns result as DataObject
  *
  * @return DataObject
  */
 public function single()
 {
     $this->execute();
     $data = $this->stmt->fetchObject('\\Core\\Data\\DataObject');
     if (!empty($data)) {
         $data = $this->executeCallbackAndSchemeHandler($data);
     }
     return $data;
 }
開發者ID:tekkla,項目名稱:core-data,代碼行數:14,代碼來源:Db.php

示例14: onCommandLartinfo

 /**
  * Returns information about a definition.
  *
  * @param string $term Term about which to return information
  *
  * @return void
  */
 public function onCommandLartinfo($term)
 {
     $this->select->execute(array(':name' => $term));
     $row = $this->select->fetchObject();
     $msg = $this->getEvent()->getNick() . ': ';
     if (!$row) {
         $msg .= 'Lart not found';
     } else {
         $msg .= 'Term: ' . $row->name . ', Definition: ' . $row->definition . ', User: ' . $row->hostmask . ', Added: ' . date('n/j/y g:i A', $row->tstamp);
     }
     $this->doNotice($this->getEvent()->getSource(), $msg);
 }
開發者ID:phergie,項目名稱:phergie,代碼行數:19,代碼來源:Lart.php

示例15: getMinimumValue

 /**
  * @param \PDOStatement $statement
  *
  * @return \MongoDate
  */
 protected function getMinimumValue(\PDOStatement $statement)
 {
     $result = $statement->fetchObject();
     if (!isset($result) || !isset($result->minimum)) {
         return new \MongoDate(strtotime($this->defaultValue));
     }
     if ($this->timezone) {
         $date = $result->minimum . ' ' . $this->timezone;
     } else {
         $date = $result->minimum;
     }
     return new \MongoDate(strtotime($date));
 }
開發者ID:jsuggs,項目名稱:etl,代碼行數:18,代碼來源:PDOMaximumColumnEmbedManyDateExtractor.php


注:本文中的PDOStatement::fetchObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。