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


PHP ResultSet::getRecordCount方法代码示例

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


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

示例1: execute

 /**
  * Generic execute() function has to check to see whether SQL is an update or select query.
  * 
  * If you already know whether it's a SELECT or an update (manipulating) SQL, then use
  * the appropriate method, as this one will incurr overhead to check the SQL.
  * 
  * @param int $fetchmode Fetchmode (only applies to queries).
  * @return boolean True if it is a result set, false if not or if no more results (this is identical to JDBC return val).
  * @throws SQLException
  * @todo -cStatementCommon Update execute() to not use isSelect() method, but rather to determine type based on returned results.
  */
 public function execute($sql, $fetchmode = null)
 {
     if (!$this->isSelect($sql)) {
         $this->updateCount = $this->executeUpdate($sql);
         return false;
     } else {
         $this->resultSet = $this->executeQuery($sql, $fetchmode);
         if ($this->resultSet->getRecordCount() === 0) {
             return false;
         }
         return true;
     }
 }
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:24,代码来源:StatementCommon.php

示例2: fetch_one

 /**
  * Returns an ActiveRecord object
  *
  * @throws RecordNotFoundException 
  * @return ActiveRecord
  */
 protected static function fetch_one(ResultSet $rs, ReflectionClass $class)
 {
     if ($rs->getRecordCount() != 1) {
         $rs->close();
         throw new RecordNotFoundException('Couldn\'t find a `' . $class->getName() . '` to match your query.');
     }
     $rs->next();
     $ar = $class->newInstance($rs->getRow());
     $rs->close();
     return $ar;
 }
开发者ID:BackupTheBerlios,项目名称:medick-svn,代码行数:17,代码来源:Base.php


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