Zend Framework

Zend_Db_Adapter_Pdo_Mssql doeas not support both LIMIT and DISTINCT in the same query

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.9.2
  • Component/s: Zend_Db
  • Labels:
    None

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'

Activity

Hide
Ralph Schindler added a comment -

A fix has been supplied in r17713, please test.

Show
Ralph Schindler added a comment - A fix has been supplied in r17713, please test.
Hide
Ralph Schindler added a comment -

Fixed in release branch 1.9

Show
Ralph Schindler added a comment - Fixed in release branch 1.9

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
1h
Original Estimate - 1 hour
Remaining:
1h
Remaining Estimate - 1 hour
Logged:
Not Specified
Time Spent - Not Specified