/** * {@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(); }
/** * 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(); }
/** * 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); }
/** * Returns the number of rows returned from the most recent query. * * @return int */ function getNumRows($cur = null) { return $this->_db->getNumRows($cur); }