Zend Framework

Zend DB Select Limit Not Executing Properly

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 1.9.7
  • Fix Version/s: None
  • Component/s: Zend_Db_Select
  • Labels:
    None

Description

If you specify a DB table then use select statement with an order and limit clause, the output for the limit range is wrong.

$nUserId = 123;
$select = $this->_table->select();
$select->where('user_id = ?', $nUserId)
->order('createddate DESC')
->limit(0, 200);

print $select;

// SELECT `myRecords`.* FROM `myRecords` WHERE (user_id = '123')
// ORDER BY `createddate` DESC LIMIT 2147483647 OFFSET 2

The limit is supposed to be 0 not 2147483647

Regards,
Cliburn M. Solano

Activity

Hide
Dan Johansson added a comment -

I just ran into this bug too, in my quick test, order does not seem to matter. It seems to be related to building a query off of Zend_Db_Table though. I am using zf 1.11.11.

Show
Dan Johansson added a comment - I just ran into this bug too, in my quick test, order does not seem to matter. It seems to be related to building a query off of Zend_Db_Table though. I am using zf 1.11.11.
Hide
Dan Johansson added a comment -

It also only occurs if the first argument is 0. Set the argument to 1 and it behaves as expected.

Show
Dan Johansson added a comment - It also only occurs if the first argument is 0. Set the argument to 1 and it behaves as expected.
Hide
Dan Johansson added a comment -

Maybe i should reread the documentation first. The argument order is opposite of what is expected in mysql. This is not a bug.

Show
Dan Johansson added a comment - Maybe i should reread the documentation first. The argument order is opposite of what is expected in mysql. This is not a bug.

People

Vote (0)
Watch (3)

Dates

  • Created:
    Updated: