/** * Counts rows from table $tableName matching $selection * @access private * * @param string $tableName * @param array $selection array( 'columnName' => array( 'columnValue' => 'columnValueType' ) ) * @param boolean $positiveSelect TRUE: select corresponding to selection, FALSE: Select NOT the selection * @return boolean TRUE: no error, FALSE: error (logged) */ function countRows($tableName, &$selection, $positiveSelect) { $where = $this->_sqlBuiildSelectionWhere($selection, $positiveSelect); $sql = 'SELECT COUNT(*) FROM ' . $this->_db->NameQuote($tableName) . "\n WHERE " . $where; $this->_db->setQuery($sql); $result = $this->_db->loadResult(); if ($result === null) { $this->_setError(sprintf('%s::countRows of Table %s Row(s) %s failed with SQL error: %s', get_class($this), $tableName, $where, $this->_db->getErrorMsg()), $sql); } return $result; }