Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-454

[GH-277] Remove duplicate SQL parts in query generation

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

      This issue is created automatically through a Github pull request on behalf of gigablah:

      Url: https://github.com/doctrine/dbal/pull/277

      Message:

      Presently, it's possible to do this using QueryBuilder:

      ```php
      $qb->select('u.*')
      ->from('users', 'u')
      ->addOrderBy('u.name', 'ASC')
      ->addOrderBy('u.name', 'ASC'); // duplicate
      ```
      Which produces:
      ```sql
      SELECT u.* FROM users u ORDER BY u.name ASC, u.name ASC
      ```

      This patch removes duplicates from the `SELECT`, `SET`, `ORDER BY` and `GROUP BY` parts during SQL generation (there's already logic that removes duplicate `FROM` parts).

      I've added test cases for each affected keyword as well.

        Activity

        Benjamin Eberlei created issue -
        Hide
        Benjamin Eberlei added a comment -

        A related Github Pull-Request [GH-277] was closed
        https://github.com/doctrine/dbal/pull/277

        Show
        Benjamin Eberlei added a comment - A related Github Pull-Request [GH-277] was closed https://github.com/doctrine/dbal/pull/277
        Marco Pivetta made changes -
        Field Original Value New Value
        Status Open [ 1 ] Closed [ 6 ]
        Assignee Benjamin Eberlei [ beberlei ] Marco Pivetta [ ocramius ]
        Resolution Invalid [ 6 ]
        Hide
        Doctrine Bot added a comment -

        A related Github Pull-Request [GH-277] was closed:
        https://github.com/doctrine/common/pull/277

        Show
        Doctrine Bot added a comment - A related Github Pull-Request [GH-277] was closed: https://github.com/doctrine/common/pull/277

        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=DBAL-454, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Marco Pivetta
            Reporter:
            Benjamin Eberlei
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: