jkk/honeysql — pull request #19 by ddellacosta (2014-03-05 12:32:12+00:00)
Title: Fixes broken values formatting (for insert-into); adds documentation in README.md for insert/update/delete

The formatting for values when passing in a hash-map is weird in 4.3:

```clj
=> (require '[honeysql.helpers :as hh] '[honeysql.core :as hsql])

;; This makes sense and is good:
=> (hsql/format (-> (hh/columns :foo :bar) (hh/values [["foo1" "bar1"] ["foo2" "bar2"]])))
["(foo, bar) VALUES (?, ?), (?, ?)" "foo1" "bar1" "foo2" "bar2"]

;; This is broken:
=> (hsql/format (hh/values {:foo "foo" :bar "bar"}))
["VALUES (foo, ?), (bar, ?)" "foo" "bar"]
```

What is correct would be this:
```clj
=> (hsql/format (hh/values {:foo "foo" :bar "bar"}))
["(foo, bar) VALUES (?, ?)" "foo" "bar"]
```

...and [based on the code](https://github.com/jkk/honeysql/blob/master/src/honeysql/format.clj#L372-L375), it seems like that was the intention. However, [`sequential?`](https://github.com/jkk/honeysql/blob/master/src/honeysql/format.clj#L369) returns true for the first values in hash-map because they convert to MapEntries, which are sequential...d'oh.

Anyways, I've fixed this and added tests. I've also added documentation in the README.md for using the new insert, update, and delete helpers.