Fixes #101 by tightening ::jdbcUrl spec
This commit is contained in:
parent
f314b4e3c4
commit
9947cf9226
2 changed files with 12 additions and 3 deletions
|
|
@ -6,7 +6,7 @@ Only accretive/fixative changes will be made from now on.
|
||||||
|
|
||||||
The following changes have been made to **master** since the 1.0.409 build:
|
The following changes have been made to **master** since the 1.0.409 build:
|
||||||
|
|
||||||
* None.
|
* Fixes #101 by tightening the spec on a JDBC URL to correctly reflect that it must start with `jdbc:`.
|
||||||
|
|
||||||
## Stable Builds
|
## Stable Builds
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,16 @@
|
||||||
::host ::port
|
::host ::port
|
||||||
::dbname-separator
|
::dbname-separator
|
||||||
::host-prefix]))
|
::host-prefix]))
|
||||||
(s/def ::jdbcUrl string?)
|
(defn jdbc-url-format?
|
||||||
|
"JDBC URLs must begin with `jdbc:` followed by the `dbtype` and
|
||||||
|
a second colon. Note: `clojure.java.jdbc` incorrectly allowed
|
||||||
|
`jdbc:` to be omitted at the beginning of a JDBC URL."
|
||||||
|
[url]
|
||||||
|
(re-find #"^jdbc:[^:]+:" url))
|
||||||
|
(s/def ::jdbcUrl (s/and string? jdbc-url-format?))
|
||||||
|
(comment
|
||||||
|
(s/explain-data ::jdbcUrl "jdbc:somedb://some-host/dbname")
|
||||||
|
(s/explain-data ::jdbcUrl "somedb://some-host/dbname"))
|
||||||
(s/def ::jdbc-url-map (s/keys :req-un [::jdbcUrl]))
|
(s/def ::jdbc-url-map (s/keys :req-un [::jdbcUrl]))
|
||||||
|
|
||||||
(s/def ::connection #(instance? Connection %))
|
(s/def ::connection #(instance? Connection %))
|
||||||
|
|
@ -52,7 +61,7 @@
|
||||||
|
|
||||||
(s/def ::db-spec (s/or :db-spec ::db-spec-map
|
(s/def ::db-spec (s/or :db-spec ::db-spec-map
|
||||||
:jdbc-url ::jdbc-url-map
|
:jdbc-url ::jdbc-url-map
|
||||||
:string string?
|
:string ::jdbcUrl
|
||||||
:ds ::datasource))
|
:ds ::datasource))
|
||||||
(s/def ::db-spec-or-jdbc (s/or :db-spec ::db-spec-map
|
(s/def ::db-spec-or-jdbc (s/or :db-spec ::db-spec-map
|
||||||
:jdbc-url ::jdbc-url-map))
|
:jdbc-url ::jdbc-url-map))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue