当前位置: 首页>>代码示例>>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;未经允许,请勿转载。