From ac92047d5edc1fa10b7d15c592ac3a48d8b44e4d Mon Sep 17 00:00:00 2001 From: Sean Corfield Date: Sun, 8 Mar 2020 15:40:08 -0700 Subject: [PATCH] Refer/link to next.jdbc as appropriate --- CHANGES.md | 3 ++- README.md | 6 ++++-- src/honeysql/format.cljc | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 9992f15..2981491 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ * Switch dev/test pipeline to use CLI/`deps.edn` instead of Leiningen. * Remove macrovich dependency as this is no longer needed with modern ClojureScript. +* Add mention of `next.jdbc` everywhere `clojure.java.jdbc` was mentioned. ## 0.9.10 @@ -70,7 +71,7 @@ * Avoid wrapping QUERY with parens while formatting `INSERT INTO ... QUERY`. (@emidln) * Allow for custom name-transform-fn. Fix #193. (@madvas) * Add :intersect to default-clause-priorities. (@kenfehling) -* Add `:parameterizer` `:none` for skipping `clojure.java.jdbc` parameter generation. (@arichiardi) +* Add `:parameterizer` `:none` for skipping `next.jdbc` or `clojure.java.jdbc` parameter generation. (@arichiardi) * Add ClojureScript self-host support. (@arichiardi) ## 0.9.1 diff --git a/README.md b/README.md index 1fc3293..c6f7f14 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Column names can be provided as keywords or symbols (but not strings -- HoneySQL ### `format` -`format` turns maps into `clojure.java.jdbc`-compatible, parameterized SQL: +`format` turns maps into `next.jdbc`-compatible (and `clojure.java.jdbc`-compatible), parameterized SQL: ```clojure (sql/format sqlmap) @@ -551,7 +551,9 @@ If you do implement a clause or function handler for an ANSI SQL, consider submi ## Why does my parameter get emitted as `()`? -If you want to use your own datatype as a parameter then the idiomatic approach of implementing `clojure.java.jdbc`'s [`ISQLValue`](https://clojure.github.io/java.jdbc/#clojure.java.jdbc/ISQLValue) protocol isn't enough as `honeysql` won't correct pass through your datatype, rather it will interpret it incorrectly. +If you want to use your own datatype as a parameter then the idiomatic approach of implementing +`next.jdbc`'s [`SettableParameter`](https://cljdoc.org/d/seancorfield/next.jdbc/CURRENT/api/next.jdbc.prepare#SettableParameter) +or `clojure.java.jdbc`'s [`ISQLValue`](https://clojure.github.io/java.jdbc/#clojure.java.jdbc/ISQLValue) protocol isn't enough as `honeysql` won't correct pass through your datatype, rather it will interpret it incorrectly. To teach `honeysql` how to handle your datatype you need to implement [`honeysql.format/ToSql`](https://github.com/jkk/honeysql/blob/a9dffec632be62c961be7d9e695d0b2b85732c53/src/honeysql/format.cljc#L94). For example: ``` clojure diff --git a/src/honeysql/format.cljc b/src/honeysql/format.cljc index 35d13dc..0fafcb5 100644 --- a/src/honeysql/format.cljc +++ b/src/honeysql/format.cljc @@ -267,7 +267,8 @@ (defn format "Takes a SQL map and optional input parameters and returns a vector - of a SQL string and parameters, as expected by clojure.java.jdbc. + of a SQL string and parameters, as expected by `next.jbc` and + `clojure.java.jdbc`. Input parameters will be filled into designated spots according to name (if a map is provided) or by position (if a sequence is provided).