Fixes #74 by mollifying Eastwood

This commit is contained in:
Sean Corfield 2019-11-13 10:40:59 -08:00
parent 5e52d30927
commit e404c47d83
6 changed files with 9 additions and 8 deletions

1
.gitignore vendored
View file

@ -5,6 +5,7 @@ pom.xml.asc
*.jar *.jar
*.class *.class
/.cpcache /.cpcache
/.eastwood
/.lein-* /.lein-*
/.nrepl-history /.nrepl-history
/.nrepl-port /.nrepl-port

View file

@ -7,6 +7,7 @@ Only accretive/fixative changes will be made from now on.
The following changes have been committed to the **master** branch since the 1.0.9 release: The following changes have been committed to the **master** branch since the 1.0.9 release:
* Fix link to **All The Options** in **Migration from `clojure.java.jdbc`**. PR #71 (@laurio). * Fix link to **All The Options** in **Migration from `clojure.java.jdbc`**. PR #71 (@laurio).
* Address #74 by making several small changes to satisfy Eastwood.
* Address #70 by adding **CLOB & BLOB SQL Types** to the **Tips & Tricks** section of **Friendly SQL Functions** and by adding `next.jdbc.result-set/clob-column-reader` and `next.jdbc.result-set/clob->string` helper to make it easier to deal with `CLOB` column data. * Address #70 by adding **CLOB & BLOB SQL Types** to the **Tips & Tricks** section of **Friendly SQL Functions** and by adding `next.jdbc.result-set/clob-column-reader` and `next.jdbc.result-set/clob->string` helper to make it easier to deal with `CLOB` column data.
* Clarify what `execute!` and `execute-one!` produce when the result set is empty (`[]` and `nil` respectively, and there are now tests for this). Similarly for `find-by-keys` and `get-by-id`. * Clarify what `execute!` and `execute-one!` produce when the result set is empty (`[]` and `nil` respectively, and there are now tests for this). Similarly for `find-by-keys` and `get-by-id`.
* Add **MS SQL Server** section to **Tips & Tricks** to note that returns an empty string for table names by default (so table-qualified column names are not available). Using the `:result-type` (scroll) and `:concurrency` options will cause table names to be returned. * Add **MS SQL Server** section to **Tips & Tricks** to note that returns an empty string for table names by default (so table-qualified column names are not available). Using the `:result-type` (scroll) and `:concurrency` options will cause table names to be returned.

View file

@ -232,4 +232,4 @@
* `:rollback-only` -- `true` / `false`." * `:rollback-only` -- `true` / `false`."
[[sym transactable opts] & body] [[sym transactable opts] & body]
(let [con (vary-meta sym assoc :tag 'java.sql.Connection)] (let [con (vary-meta sym assoc :tag 'java.sql.Connection)]
`(transact ~transactable (^{:once true} fn* [~con] ~@body) (or ~opts {})))) `(transact ~transactable (^{:once true} fn* [~con] ~@body) ~(or opts {}))))

View file

@ -183,9 +183,8 @@
(if-let [class-name (or classname (-> dbtype dbtypes :classname))] (if-let [class-name (or classname (-> dbtype dbtypes :classname))]
(swap! driver-cache update class-name (swap! driver-cache update class-name
#(if % % #(if % %
(do (let [;; force DriverManager to be loaded
;; force DriverManager to be loaded _ (DriverManager/getLoginTimeout)]
(DriverManager/getLoginTimeout)
(if (string? class-name) (if (string? class-name)
(clojure.lang.RT/loadClassForName class-name) (clojure.lang.RT/loadClassForName class-name)
(loop [[clazz & more] class-name] (loop [[clazz & more] class-name]

View file

@ -107,8 +107,8 @@
(let [[url etc] (#'c/spec->url+etc db) (let [[url etc] (#'c/spec->url+etc db)
ds (p/get-datasource (assoc etc :jdbcUrl url))] ds (p/get-datasource (assoc etc :jdbcUrl url))]
(if (= "derby" (:dbtype db)) (if (= "derby" (:dbtype db))
(is {:create true} etc) (is (= {:create true} etc))
(is {} etc)) (is (= {} etc)))
(is (instance? javax.sql.DataSource ds)) (is (instance? javax.sql.DataSource ds))
(is (str/index-of (pr-str ds) (str "jdbc:" (:dbtype db)))) (is (str/index-of (pr-str ds) (str "jdbc:" (:dbtype db))))
;; checks get-datasource on a DataSource is identity ;; checks get-datasource on a DataSource is identity

View file

@ -194,8 +194,8 @@ VALUES ('Pear', 'green', 49, 47)
(let [[url etc] (#'c/spec->url+etc (db)) (let [[url etc] (#'c/spec->url+etc (db))
ds (jdbc/get-datasource (assoc etc :jdbcUrl url))] ds (jdbc/get-datasource (assoc etc :jdbcUrl url))]
(if (derby?) (if (derby?)
(is {:create true} etc) (is (= {:create true} etc))
(is {} etc)) (is (= {} etc)))
(is (instance? javax.sql.DataSource ds)) (is (instance? javax.sql.DataSource ds))
(is (str/index-of (pr-str ds) (str "jdbc:" (:dbtype (db))))) (is (str/index-of (pr-str ds) (str "jdbc:" (:dbtype (db)))))
;; checks get-datasource on a DataSource is identity ;; checks get-datasource on a DataSource is identity