Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1696

String support in THEN and ELSE part of CASE expression is broken

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: 2.3
    • Component/s: DQL
    • Security Level: All
    • Labels:
      None

      Description

      The SQL generated when using strings in the THEN and ELSE parts of the CASE expression are not valid.

      This testcase will fail:
      $this->assertSqlGeneration(
      "SELECT g.id, CASE WHEN ((g.id / 2) > 18) THEN 'Foo' ELSE 'Bar' END AS test FROM Doctrine\Tests\Models\CMS\CmsGroup g",
      "SELECT c0_.id AS id0, CASE WHEN (c0_.id / 2 > 18) THEN 'Foo' ELSE 'Bar' END AS sclr1 FROM cms_groups c0_"
      );

      Noticed by a user at github:
      https://github.com/doctrine/doctrine2/pull/277
      https://github.com/doctrine/doctrine2/pull/278

        Activity

        Alexander created issue -
        Alexander made changes -
        Field Original Value New Value
        Description The SQL generated when using strings in the THEN and ELSE parts of the CASE expression are not valid.

        This testcase will fail:
                $this->assertSqlGeneration(
                    "SELECT g.id, CASE WHEN ((g.id / 2) > 18) THEN 'Foo' ELSE 'Bar' END AS test FROM Doctrine\Tests\Models\CMS\CmsGroup g",
                    "SELECT c0_.id AS id0, CASE WHEN (c0_.id / 2 > 18) THEN 'Foo' ELSE 'Bar' END AS sclr1 FROM cms_groups c0_"
                );
        The SQL generated when using strings in the THEN and ELSE parts of the CASE expression are not valid.

        This testcase will fail:
                $this->assertSqlGeneration(
                    "SELECT g.id, CASE WHEN ((g.id / 2) > 18) THEN 'Foo' ELSE 'Bar' END AS test FROM Doctrine\Tests\Models\CMS\CmsGroup g",
                    "SELECT c0_.id AS id0, CASE WHEN (c0_.id / 2 > 18) THEN 'Foo' ELSE 'Bar' END AS sclr1 FROM cms_groups c0_"
                );


        Noticed by a user at github:
        https://github.com/doctrine/doctrine2/pull/277
        https://github.com/doctrine/doctrine2/pull/278
        Hide
        Guilherme Blanco added a comment -
        Show
        Guilherme Blanco added a comment - Fixed by https://github.com/doctrine/doctrine2/commit/795438670517cd7a4e76bca6dd33fdc9bbb5d988 @beberlei please merge in 2.2! =D
        Guilherme Blanco made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.3 [ 10185 ]
        Resolution Fixed [ 1 ]
        Benjamin Eberlei made changes -
        Workflow jira [ 13519 ] jira-feedback [ 15269 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback [ 15269 ] jira-feedback2 [ 17133 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 17133 ] jira-feedback3 [ 19386 ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-1696, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Guilherme Blanco
            Reporter:
            Alexander
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: