fix set-dialect! reset and document it
This commit is contained in:
parent
63df2f3dc9
commit
723b134e90
2 changed files with 8 additions and 5 deletions
|
|
@ -339,6 +339,8 @@ globally via the `set-dialect!` function.
|
|||
;; and reset back to the default of :ansi
|
||||
(sql/set-dialect! :ansi)
|
||||
;;=> nil
|
||||
;; which also resets the quoting default (back to nil)
|
||||
;; so only unusual entity names get quoted:
|
||||
(sql/format '{select (id) from (table)} {:quoted true})
|
||||
;;=> ["SELECT \"id\" FROM \"table\""]
|
||||
```
|
||||
|
|
|
|||
|
|
@ -1563,16 +1563,17 @@
|
|||
Can be: `:ansi` (the default), `:mysql`, `:oracle`, or `:sqlserver`.
|
||||
|
||||
Can optionally accept `:quoted true` (or `:quoted false`) to set the
|
||||
default global quoting strategy. Note that calling `set-options!` can
|
||||
override this default.
|
||||
default global quoting strategy. Without `:quoted`, the default global
|
||||
quoting strategy will be reset (only quoting unusual entity names).
|
||||
|
||||
Note that calling `set-options!` can override this default.
|
||||
|
||||
Dialects are always applied to the base order to create the current order."
|
||||
[dialect & {:as opts}]
|
||||
[dialect & {:keys [quoted]}]
|
||||
(reset! default-dialect (get @dialects (check-dialect dialect)))
|
||||
(when-let [f (:clause-order-fn @default-dialect)]
|
||||
(reset! current-clause-order (f @base-clause-order)))
|
||||
(when (contains? opts :quoted)
|
||||
(reset! default-quoted (:quoted opts))))
|
||||
(reset! default-quoted quoted))
|
||||
|
||||
(defn set-options!
|
||||
"Set default values for any or all of the following options:
|
||||
|
|
|
|||
Loading…
Reference in a new issue