[DBAL-454] [GH-277] Remove duplicate SQL parts in query generation Created: 02/Mar/13  Updated: 20/Aug/13  Resolved: 03/Mar/13

Status: Closed
Project: Doctrine DBAL
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Benjamin Eberlei Assignee: Marco Pivetta
Resolution: Invalid Votes: 0
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.



 Comments   
Comment by Benjamin Eberlei [ 03/Mar/13 ]

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

Comment by Doctrine Bot [ 20/Aug/13 ]

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

Generated at Wed Jul 30 01:11:08 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.