fix set-dialect! and update from values docs

Signed-off-by: Sean Corfield <sean@corfield.org>
This commit is contained in:
Sean Corfield 2024-06-09 11:44:21 -07:00
parent 2f55f423b9
commit bab4ce4bd5
No known key found for this signature in database
4 changed files with 4 additions and 4 deletions

View file

@ -1,7 +1,7 @@
# Changes # Changes
* 2.6.next in progress * 2.6.next in progress
* Address [#531](https://github.com/seancorfield/honeysql/issues/531) and [#527](https://github.com/seancorfield/honeysql/issues/527) by adding tests and more documentation for `:composite`. * Address [#531](https://github.com/seancorfield/honeysql/issues/531) and [#527](https://github.com/seancorfield/honeysql/issues/527) by adding tests and more documentation for `:composite`; fix bug in `set-dialect!` where clause order is not restored.
* Address [#529](https://github.com/seancorfield/honeysql/issues/529) by fixing `:join` special syntax to support aliases and to handle expressions the same way `select` / `from` etc handle them (extra `[...]` nesting). * Address [#529](https://github.com/seancorfield/honeysql/issues/529) by fixing `:join` special syntax to support aliases and to handle expressions the same way `select` / `from` etc handle them (extra `[...]` nesting).
* Add example of mixed `DO UPDATE SET` with `EXCLUDED` and regular SQL expressions. * Add example of mixed `DO UPDATE SET` with `EXCLUDED` and regular SQL expressions.
* Improve exception message when un-`lift`-ed JSON expressions are used in the DSL. * Improve exception message when un-`lift`-ed JSON expressions are used in the DSL.

View file

@ -752,7 +752,7 @@ You can also `UPDATE .. FROM (VALUES ..) ..` where you might also need `:composi
[4 5 6]]} [4 5 6]]}
[:v [:composite :a :b :c]]]] [:v [:composite :a :b :c]]]]
:where [:and [:= :x :v.b] [:> :y :v.c]]}) :where [:and [:= :x :v.b] [:> :y :v.c]]})
;;=> ["UPDATE table FROM (VALUES (?, ?, ?), (?, ?, ?)) AS v (a, b, c) SET a = v.a WHERE (x = v.b) AND (y > v.c)" 1 2 3 4 5 6] ["UPDATE table SET a = v.a FROM (VALUES (?, ?, ?), (?, ?, ?)) AS v (a, b, c) WHERE (x = v.b) AND (y > v.c)" 1 2 3 4 5 6]
``` ```
## delete, delete-from ## delete, delete-from

View file

@ -188,7 +188,7 @@ value, as above, or a composite based on or declaring columns names:
[4 5 6]]} [4 5 6]]}
[:v [:composite :a :b :c]]]] [:v [:composite :a :b :c]]]]
:where [:and [:= :x :v.b] [:> :y :v.c]]}) :where [:and [:= :x :v.b] [:> :y :v.c]]})
;;=> ["UPDATE table FROM (VALUES (?, ?, ?), (?, ?, ?)) AS v (a, b, c) SET a = v.a WHERE (x = v.b) AND (y > v.c)" 1 2 3 4 5 6] ;;=> ["UPDATE table SET a = v.a FROM (VALUES (?, ?, ?), (?, ?, ?)) AS v (a, b, c) WHERE (x = v.b) AND (y > v.c)" 1 2 3 4 5 6]
``` ```
## distinct ## distinct

View file

@ -2130,7 +2130,7 @@
Dialects are always applied to the base order to create the current order." Dialects are always applied to the base order to create the current order."
[dialect & {:keys [quoted]}] [dialect & {:keys [quoted]}]
(reset! default-dialect (get @dialects (check-dialect dialect))) (reset! default-dialect (get @dialects (check-dialect dialect)))
(when-let [f (:clause-order-fn @default-dialect)] (let [f (:clause-order-fn @default-dialect identity)]
(reset! current-clause-order (f @base-clause-order))) (reset! current-clause-order (f @base-clause-order)))
(reset! default-quoted quoted)) (reset! default-quoted quoted))