ZF-4251: Zend_Db_Adapter_Pdo_Mssql doeas not support both LIMIT and DISTINCT in the same query

Issue Type: Bug Created: 2008-09-11T08:26:08.000+0000 Last Updated: 2009-08-24T10:50:25.000+0000 Status: Resolved Fix version(s): - 1.9.2 (25/Aug/09)

Reporter: Zsolt Gyöngyösi (gyongyeee) Assignee: Ralph Schindler (ralph) Tags: - Zend_Db

Related issues: Attachments:


MsSql does not support OFFSET parameter for LIMIT. Zend_Db_Adapter_Pdo_Mssql implements a workaround by using the original query as a subquery, so it prepends and appends the required code to the original query. Zend_Db_Adapter_Pdo_Mssql->limit method not takes care of the DISTINCT clause, so generates ... (SELECT TOP xx DISTINCT ... like query, but the correct syntax would be ...( SELECT DISTINCT TOP xx ...

Possible correction use '/^SELECT\s+(DISTINCT\s+)?/i' regular expression insead of '/^SELECT\s/i'


Posted by Ralph Schindler (ralph) on 2009-08-21T07:03:04.000+0000

A fix has been supplied in r17713, please test.

Posted by Ralph Schindler (ralph) on 2009-08-24T10:50:25.000+0000

Fixed in release branch 1.9

Have you found an issue?

See the Overview section for more details.


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

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