本文整理匯總了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);
}