Changeset 350
- Timestamp:
- 01/15/07 11:29:32 (2 years ago)
- Files:
-
- trunk/lib/jelix/dao/jDaoBase.class.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/jelix/dao/jDaoBase.class.php
r328 r350 4 4 * @subpackage dao 5 5 * @author Laurent Jouanneau 6 * @contributor 6 * @contributor Loic Mathaud 7 7 * @copyright 2005-2006 Laurent Jouanneau 8 * @copyright 2007 Loic Mathaud 8 9 * @link http://www.jelix.org 9 10 * @licence http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file … … 272 273 } 273 274 275 /** 276 * return the number of records corresponding to the conditions stored into the 277 * jDaoConditions object. 278 * @author Loic Mathaud 279 * @copyright 2007 Loic Mathaud 280 * @since 1.0b2 281 * @param jDaoConditions $searchcond 282 * @return int the count 283 */ 284 public function countBy($searchcond) { 285 $query = 'SELECT COUNT(*) as c '.$this->_fromClause.$this->_whereClause; 286 if (!$searchcond->isEmpty ()){ 287 $query .= ($this->_whereClause !='' ? ' AND ' : ' WHERE '); 288 $query .= $this->_createConditionsClause($searchcond); 289 } 290 $rs = $this->_conn->query ($query); 291 $res = $rs->fetch(); 292 return intval($res->c); 293 } 294 274 295 abstract protected function _getPkWhereClauseForSelect($pk); 275 296 abstract protected function _getPkWhereClauseForNonSelect($pk);
