ZF-4251: Zend_Db_Adapter_Pdo_Mssql doeas not support both LIMIT and DISTINCT in the same query
Description
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'
Comments
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