本文整理汇总了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;
}
}
示例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;
}