本文整理汇总了PHP中JDatabaseDriver::getNumRows方法的典型用法代码示例。如果您正苦于以下问题:PHP JDatabaseDriver::getNumRows方法的具体用法?PHP JDatabaseDriver::getNumRows怎么用?PHP JDatabaseDriver::getNumRows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JDatabaseDriver
的用法示例。
在下文中一共展示了JDatabaseDriver::getNumRows方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: query
/**
* {@inheritdoc}
*/
public function query($sql)
{
$sql = $this->_prepareSql($sql);
$result = $this->_db->setQuery($sql)->execute();
if (is_bool($result)) {
return $result;
}
return $this->_db->getNumRows();
}
示例2: _getListCount
/**
* Returns a record count for the query.
*
* @param JDatabaseQuery|string $query The query.
*
* @return integer Number of rows for query.
*
* @since 12.2
*/
protected function _getListCount($query)
{
// Use fast COUNT(*) on JDatabaseQuery objects if there is no GROUP BY or HAVING clause:
if ($query instanceof JDatabaseQuery && $query->type == 'select' && $query->group === null && $query->union === null && $query->unionAll === null && $query->having === null) {
$query = clone $query;
$query->clear('select')->clear('order')->clear('limit')->clear('offset')->select('COUNT(*)');
$this->_db->setQuery($query);
return (int) $this->_db->loadResult();
}
// Otherwise fall back to inefficient way of counting all results.
// Remove the limit and offset part if it's a JDatabaseQuery object
if ($query instanceof JDatabaseQuery) {
$query = clone $query;
$query->clear('limit')->clear('offset');
}
$this->_db->setQuery($query);
$this->_db->execute();
return (int) $this->_db->getNumRows();
}
示例3: getNumRows
/**
* Returns the number of rows returned from the most recent query.
*
* @param \mysqli_result|\resource $cursor
* @return int
*/
public function getNumRows($cursor = null)
{
return $this->_db->getNumRows($cursor);
}
示例4: getNumRows
/**
* Returns the number of rows returned from the most recent query.
*
* @return int
*/
function getNumRows($cur = null)
{
return $this->_db->getNumRows($cur);
}