Issues

ZF-11495: Pdo_Mysql limit() method generate " LIMIT ... OFFSET ..."

Issue Type: Bug Created: 2011-06-20T08:10:30.000+0000 Last Updated: 2011-06-24T10:50:05.000+0000 Status: Closed Fix version(s): Reporter: newARTix (newartix) Assignee: Francescu GAROBY (f.garoby) Tags: - Zend_Db

Related issues: Attachments:

Description

$oSelect->limit(10,5); result: ... LIMIT 10 OFFSET 5; expected: ... LIMIT 5, 10;

correction: Zend/Db/Adapter/Pdo/Mysql.php

find:

    $sql .= " LIMIT $count";
    if ($offset > 0) {
        $sql .= " OFFSET $offset";

}

replace:

    if ($offset > 0) {
        $sql .= " LIMIT $offset, $count";
    }
    else {
        $sql .= " LIMIT $count";

}

Comments

Posted by Francescu GAROBY (f.garoby) on 2011-06-24T09:06:53.000+0000

The MySQL documentation says that the current syntax is correct, and is used for compatibility with PostgreSQL. Why do you want to change it ?

cf. http://dev.mysql.com/doc/refman/5.0/en/select.html

Posted by newARTix (newartix) on 2011-06-24T09:39:13.000+0000

sorry, there was an error in my own code. Please close the issue.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts