developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#665 closed bug (fixed)

Jelix DAO should not ignore limit=0

Reported by: greut Owned by:
Priority: low Milestone: Jelix 1.1 beta 1
Component: jelix:dao Version: 1.0.5
Severity: minor Keywords:
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:

Description

As I can do that in MySQL:

SELECT * FROM `eggs` LIMIT 0;

I should be able to do that with dao

<?php
$eggs->findBy($conditions, 0, 0);

And expecting the same result.

diff -r 5bcc7e23ecb1 www/lib/jelix/dao/jDaoFactoryBase.class.php
--- a/www/lib/jelix/dao/jDaoFactoryBase.class.php	Tue Aug 19 09:19:47 2008 +0200
+++ b/www/lib/jelix/dao/jDaoFactoryBase.class.php	Tue Aug 19 11:36:22 2008 +0200
@@ -236,7 +236,7 @@
      * @param int $limitCount 
      * @return jDbResultSet
      */
-    final public function findBy ($searchcond, $limitOffset=0, $limitCount=0){
+    final public function findBy ($searchcond, $limitOffset=0, $limitCount=null){
         $query = $this->_selectClause.$this->_fromClause.$this->_whereClause;
         if ($searchcond->hasConditions ()){
             $query .= ($this->_whereClause !='' ? ' AND ' : ' WHERE ');
@@ -244,7 +244,7 @@
         }
         $query.= $this->_createOrderClause($searchcond);
         
-        if($limitCount != 0){
+        if($limitCount !== null){
             $rs = $this->_conn->limitQuery ($query, $limitOffset, $limitCount);
         }else{
             $rs = $this->_conn->query ($query);

Thanks!

Change History (4)

comment:1 Changed 12 years ago by laurentj

  • Component changed from jelix to jelix:dao
  • Documentation needed set
  • Milestone set to Jelix 1.0beta1
  • Priority changed from normal to low
  • review set to review+
  • Severity changed from normal to minor

comment:2 Changed 12 years ago by laurentj

  • Milestone changed from Jelix 1.0beta1 to Jelix 1.1 beta 1

comment:3 Changed 12 years ago by laurentj

  • Resolution set to fixed
  • Status changed from new to closed

Committed in the trunk. svn 1059.

comment:4 Changed 12 years ago by laurentj

  • Documentation needed unset
Note: See TracTickets for help on using tickets.