Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
updating readme
  • Loading branch information
ninanator committed Mar 19, 2016
commit 450b85d292f2f8c5f68bc042ca00429ff93681b5
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ in the REPL:

;=> -------------------------
;=> user/users-by-country
;=> ([{:keys [country_code]}]
;=> ([{:keys [country_code]}]
;=> [{:keys [country_code]} {:keys [connection]}])
;=>
;=> Counts the users in a given country.
Expand Down Expand Up @@ -351,6 +351,13 @@ INSERT INTO person (name) VALUES (:name)
;=> {:name "Dave" :id 5}
```

To batch insert, Yesql will take a vector of maps.

```clojure
(create-person<! [{:name "Dave"} {:name "Jill"}])
;=> '({:name "Dave" :id 5} {:name "Jill" :id 6})
```

The exact return value will depend on your database driver. For
example PostgreSQL returns the whole row, whereas Derby returns just
`{:1 5M}`.
Expand Down
4 changes: 2 additions & 2 deletions src/yesql/generate.clj
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@
(defn insert-handler
[db sql params call-options]
(if (vector? params)
(let [full-query (apply str sql)
table-name (re-find insert-table-name-regex full-query)]
(let [full-query (apply str sql)
table-name (re-find insert-table-name-regex full-query)]
(sane-query? sql params)
(apply jdbc/insert! db table-name params))
(let [[rewritten-sql & rewritten-params] (rewrite-query-for-jdbc sql params)]
Expand Down