sequelize/sequelize — pull request #636 by mweibel (2013-05-21 20:19:26+00:00)
Title: SQLite addQuotes is not correct

I discovered this by doing the following query:

```javascript
Task.findAll({
attributes: [['SUM("reward")', 'points'], 'fulfillorId']
, include: [{ model: Resident, as: 'Fulfillor' }]
, where:
['"Tasks"."fulfillorId" IN (' + residentIds.join(',') + ') ' /*+
'AND "Tasks"."fulfilledAt" >= ?', lastWeek*/]
, group: ['Tasks.fulfillorId', 'Fulfillor.id']
, order: '"points" DESC'
}, {'raw': true})
```
The groupBy Statement was incorrectly quoted in SQLite. Therefore it worked with Postgres, but not with SQLite.

I hence copied the `addQuotes()`/`removeQuotes()` from the postgres dialect and adapted it to use backticks.
This initially didn't work because the inheritance of the mysql query-generator in sqlite doesn't seem to work as one would expect. Therefore the `selectQuery()` would still use the `addQuotes()`/`removeQuotes()` from the mysql query generator.

By changing this, I noticed that the tests don't run anymore for sqlite because the backticks are compared. I changed the test but I'm not 100% sure if this breaks anything or not.

So, I guess this patch is not something which should be merged but maybe a starting point what to do here.
Also, with a proper patch later, it should be possible to add a few more test cases for this.

Please tell me what you think :)

- Michael