Fixed doModifyLimitQuery for SQLServerPlatform #249

Merged
merged 1 commit into from Jan 20, 2013

Projects

None yet

3 participants

@norzechowicz

It seems that there is a problem in SQLServerPlatform doModifyLimitQuery method.
I can't use Doctrine ORM Paginator because of wrong position of DISTINCT statement in final limit subquery, here is the exception message I'm getting.
SQLSTATE[42000]: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near the keyword 'DISTINCT'.

My proposition is to change doModifyLimitQuery result from:

SELECT * FROM (SELECT ROW_NUMBER() OVER (ORDER BY username DESC) AS doctrine_rownum, * FROM user) ...

into:

SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY username DESC) AS doctrine_rownum FROM user) ...

@doctrinebot
Collaborator

Hello,

thank you for positing this Pull Request. I have automatically opened an issue on our Jira Bug Tracker for you with the details of this Pull-Request. See the Link:

http://doctrine-project.org/jira/browse/DBAL-416

@beberlei
Member
@norzechowicz

@beberlei this PR works fine with simple Doctrine Paginator and it fix first point from this list (second point seems to be already done), I can also check those 2 other points and eventually think about some solution if you want.

@beberlei
Member

@norzechowicz thanks, help is very much appreciated with SQL Server, we don't have a core member that is using it in production and could always use somebody that offers some time for maintaining the complicated parts :-)

@beberlei beberlei merged commit f3374cb into doctrine:master Jan 20, 2013

1 check passed

Details default The Travis build passed
@norzechowicz norzechowicz deleted the norzechowicz:sqlserver-platform branch Jan 20, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment