Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Related to DDC-2282 #623

Closed
wants to merge 3 commits into from

2 participants

Aaron DM doctrinebot
Aaron DM

This is related to the patch DDC-2282, the same patch also needs to be applied here, exact same issue.

Aaron DM AaronDDM Related to DDC-2282
This is related to the patch DDC-2282, the same patch also needs to be applied here, exact same issue.
886516d
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/DDC-2361

AaronDDM added some commits
Aaron DM AaronDDM Added test for DDC-2361 9ae3b7a
Aaron DM AaronDDM Only test if SQL Server
Added the check to skip the test if not sql server
549348e
Aaron DM

Wow, clearly I wasn't thinking straight when pushing this commit. Please do not merge this and close it.

I have to see how else this bug can be fixed because this basically renders the ORDER BY clause useless for retrieving results.

Aaron DM AaronDDM closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 21, 2013
  1. Aaron DM

    Related to DDC-2282

    AaronDDM authored
    This is related to the patch DDC-2282, the same patch also needs to be applied here, exact same issue.
Commits on Mar 22, 2013
  1. Aaron DM

    Added test for DDC-2361

    AaronDDM authored
  2. Aaron DM

    Only test if SQL Server

    AaronDDM authored
    Added the check to skip the test if not sql server
This page is out of date. Refresh to see the latest.
4 lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php
View
@@ -91,6 +91,10 @@ public function __construct($query, $parserResult, array $queryComponents)
*/
public function walkSelectStatement(SelectStatement $AST)
{
+ if ($this->platform->getName() === "mssql") {
+ $AST->orderByClause = null;
+ }
+
$innerSql = parent::walkSelectStatement($AST);
// Find out the SQL alias of the identifier column of the root entity.
16 tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryOutputWalkerTest.php
View
@@ -95,5 +95,21 @@ public function testCountQuery_MixedResultsWithName()
"SELECT DISTINCT id0 FROM (SELECT a0_.id AS id0, a0_.name AS name1, sum(a0_.name) AS sclr2 FROM Author a0_) dctrn_result", $limitQuery->getSql()
);
}
+
+ public function testLimitSubqueryOrderBySqlServer()
+ {
+ if ($this->entityManager->getConnection()->getDatabasePlatform()->getName() !== "mssql") {
+ $this->markTestSkipped('SQLServer only test.');
+ }
+
+ $query = $this->entityManager->createQuery(
+ 'SELECT a, sum(a.name) as foo FROM Doctrine\Tests\ORM\Tools\Pagination\Author a ORDER BY a.id');
+ $limitQuery = clone $query;
+ $limitQuery->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Doctrine\ORM\Tools\Pagination\LimitSubqueryOutputWalker');
+
+ $this->assertEquals(
+ "SELECT DISTINCT id0 FROM (SELECT a0_.id AS id0, a0_.name AS name1, sum(a0_.name) AS sclr2 FROM Author a0_) dctrn_result", $limitQuery->getSql()
+ );
+ }
}
Something went wrong with that request. Please try again.