fixes #374
This commit is contained in:
parent
b30aa0f3f9
commit
8979e938f3
8 changed files with 56 additions and 13 deletions
2
.github/workflows/test-and-release.yml
vendored
2
.github/workflows/test-and-release.yml
vendored
|
|
@ -19,7 +19,7 @@ jobs:
|
|||
- name: Setup Clojure
|
||||
uses: DeLaGuardo/setup-clojure@master
|
||||
with:
|
||||
tools-deps: '1.10.3.1040'
|
||||
tools-deps: '1.10.3.1053'
|
||||
- name: Cache All The Things
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
|
|
|
|||
4
.github/workflows/test-and-snapshot.yml
vendored
4
.github/workflows/test-and-snapshot.yml
vendored
|
|
@ -17,7 +17,7 @@ jobs:
|
|||
- name: Setup Clojure
|
||||
uses: DeLaGuardo/setup-clojure@master
|
||||
with:
|
||||
tools-deps: '1.10.3.1040'
|
||||
tools-deps: '1.10.3.1053'
|
||||
- name: Cache All The Things
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
|
|
@ -49,7 +49,7 @@ jobs:
|
|||
- name: Clojure CLI
|
||||
uses: DeLaGuardo/setup-clojure@master
|
||||
with:
|
||||
tools-deps: '1.10.3.1040'
|
||||
tools-deps: '1.10.3.1053'
|
||||
- name: Cache All The Things
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
|
|
|
|||
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
|
|
@ -17,7 +17,7 @@ jobs:
|
|||
- name: Clojure CLI
|
||||
uses: DeLaGuardo/setup-clojure@master
|
||||
with:
|
||||
tools-deps: '1.10.3.1040'
|
||||
tools-deps: '1.10.3.1053'
|
||||
- name: Cache All The Things
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
|
|
|
|||
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
* 2.1.next in progress
|
||||
* Fix #375 for `:nest` statement.
|
||||
* Fix #374 by removing aliasing of `:is` / `:is-not` -- this changes the behavior of `[:is-not :col true/false]` to be _correct_ and _include `NULL` values_. Using `:is` / `:is-not` with values that are not Boolean and not `nil` will produce invalid SQL.
|
||||
* Update test dependencies.
|
||||
* Update `build-clj` to v0.6.1.
|
||||
* Update `build-clj` to v0.6.5.
|
||||
|
||||
* 2.1.833 -- 2021-12-03
|
||||
* Fix #372 by merging `:select-distinct-on` differently.
|
||||
|
|
|
|||
2
deps.edn
2
deps.edn
|
|
@ -4,7 +4,7 @@
|
|||
:aliases
|
||||
{;; for help: clojure -A:deps -T:build help/doc
|
||||
:build {:deps {io.github.seancorfield/build-clj
|
||||
{:git/tag "v0.6.2" :git/sha "97c275a"}}
|
||||
{:git/tag "v0.6.5" :git/sha "972031a"}}
|
||||
:ns-default build}
|
||||
|
||||
;; versions to test against:
|
||||
|
|
|
|||
|
|
@ -37,9 +37,31 @@ can simply evaluate to `nil` instead).
|
|||
Binary comparison operators. These expect exactly
|
||||
two arguments.
|
||||
|
||||
The following aliases are also supported:
|
||||
* `is` -- an alias for `=`
|
||||
* `is-not`, `not=`, `!=` -- aliases for `<>`
|
||||
`not=` and `!=` are accepted as aliases for `<>`.
|
||||
|
||||
## is, is-not
|
||||
|
||||
Binary predicates for `NULL` and Boolean values:
|
||||
|
||||
```clojure
|
||||
{...
|
||||
:where [:is :id nil]
|
||||
...}
|
||||
;;=> ["...WHERE col IS NULL..."]
|
||||
{...
|
||||
:where [:is-not :id nil]
|
||||
...}
|
||||
;;=> ["...WHERE col IS NOT NULL..."]
|
||||
{...
|
||||
:where [:is :col true]
|
||||
...}
|
||||
;;=> ["...WHERE col IS TRUE..."]
|
||||
{...
|
||||
;; unlike [:<> :col false], the following will include NULLs:
|
||||
:where [:is-not :col false]
|
||||
...}
|
||||
;;=> ["...WHERE col IS NOT FALSE..."]
|
||||
```
|
||||
|
||||
## mod, xor, + - * / % | & ^
|
||||
|
||||
|
|
|
|||
|
|
@ -988,9 +988,7 @@
|
|||
|
||||
(def ^:private infix-aliases
|
||||
"Provided for backward compatibility with earlier HoneySQL versions."
|
||||
{:is :=
|
||||
:is-not :<>
|
||||
:not= :<>
|
||||
{:not= :<>
|
||||
:!= :<>
|
||||
:regex :regexp})
|
||||
|
||||
|
|
|
|||
|
|
@ -14,17 +14,39 @@
|
|||
{:dialect :mysql}))))
|
||||
|
||||
(deftest expr-tests
|
||||
;; special-cased = nil:
|
||||
(is (= ["id IS NULL"]
|
||||
(sut/format-expr [:= :id nil])))
|
||||
(is (= ["id IS NULL"]
|
||||
(sut/format-expr [:is :id nil])))
|
||||
(is (= ["id = TRUE"]
|
||||
(sut/format-expr [:= :id true])))
|
||||
(is (= ["id IS TRUE"]
|
||||
(sut/format-expr [:is :id true])))
|
||||
(is (= ["id <> TRUE"]
|
||||
(sut/format-expr [:<> :id true])))
|
||||
(is (= ["id IS NOT TRUE"]
|
||||
(sut/format-expr [:is-not :id true])))
|
||||
(is (= ["id = FALSE"]
|
||||
(sut/format-expr [:= :id false])))
|
||||
(is (= ["id IS FALSE"]
|
||||
(sut/format-expr [:is :id false])))
|
||||
(is (= ["id <> FALSE"]
|
||||
(sut/format-expr [:<> :id false])))
|
||||
(is (= ["id IS NOT FALSE"]
|
||||
(sut/format-expr [:is-not :id false])))
|
||||
;; special-cased <> nil:
|
||||
(is (= ["id IS NOT NULL"]
|
||||
(sut/format-expr [:<> :id nil])))
|
||||
;; legacy alias:
|
||||
(is (= ["id IS NOT NULL"]
|
||||
(sut/format-expr [:!= :id nil])))
|
||||
;; legacy alias:
|
||||
(is (= ["id IS NOT NULL"]
|
||||
(sut/format-expr [:not= :id nil])))
|
||||
(is (= ["id IS NOT NULL"]
|
||||
(sut/format-expr [:is-not :id nil])))
|
||||
;; degenerate cases:
|
||||
;; degenerate (special) cases:
|
||||
(is (= ["NULL IS NULL"]
|
||||
(sut/format-expr [:= nil nil])))
|
||||
(is (= ["NULL IS NOT NULL"]
|
||||
|
|
|
|||
Loading…
Reference in a new issue