sequelize/sequelize — pull request #608 by terraflubb (2013-05-10 20:01:48+00:00)
Title: Properly process booleans in MySQL dialect to fix #607

Fixes #607

The problem was that queries generated by with the MySQL dialect (where `Sequelize.BOOLEAN` is a `TINYINT(1)`) contained booleans in the form `true` or `false` instead of `1` or `0`. This was causing all my queries involving adding or updating booleans to fail to the default. A whole lot of true values where I wasn't expecting them!

The solution was to make sure that when values were being passed into a query, we check if they're boolean, and if we do then turn them into integers.

When I was doing that, I noticed that there was duplicated logic for processing values (where it was checked if the value was a `Date`) all over the place, but not everywhere. In particular, the values used to build `WHERE` clauses.

So I factored all the logic for processing values (checking the type then escaping) into a function and called it from every where the logic was duplicated, and added it to the `hashToWhereConditions` too.

I included failing tests and I ran the entire test suite locally before committing.

Also to make sure I was doing it right, I ran JSHint like the README suggested. I saw a handful of minor lints I picked off. If this isn't cool, let me know and I'll revert that commit.

(I was also careful not to use any semicolons ;) )