extend lint checks to several column lists
This commit is contained in:
parent
dc37852024
commit
e0cafbd434
3 changed files with 7 additions and 1 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
* 2.1.next in progress
|
||||
* Fix #372 by merging `:select-distinct-on` differently.
|
||||
* Add empty column list check for `SELECT` and several other clauses, when `:checking :basic` (or `:strict`) is provided.
|
||||
* Update `build-clj` to v0.6.0.
|
||||
|
||||
* 2.1.829 -- 2021-11-27
|
||||
|
|
|
|||
|
|
@ -364,7 +364,8 @@ was wrapped in `[:inline `..`]`:
|
|||
* everything else is just turned into a string (by calling `str`) and added to the SQL string.
|
||||
|
||||
The `:checking` option defaults to `:none`. If `:checking :basic` is
|
||||
specified, certain obvious errors -- such as `IN` with an empty collection --
|
||||
specified, certain obvious errors -- such as `IN` with an empty collection
|
||||
or `SELECT` with an empty list of columns --
|
||||
are treated as an error and an exception is thrown. If `:checking :strict`
|
||||
is specified, certain dubious constructs -- such as `IN` with a collection
|
||||
containing `NULL` values -- are also treated as an error and an exception is
|
||||
|
|
|
|||
|
|
@ -372,6 +372,10 @@
|
|||
[(conj sql sql') (if params' (into params params') params)])
|
||||
[[] []]
|
||||
(map #(format-selectable-dsl % {:as as}) xs))]
|
||||
(when-not (= :none *checking*)
|
||||
(when (empty? xs)
|
||||
(throw (ex-info (str prefix " empty column list is illegal")
|
||||
{:clause (into [prefix] xs)}))))
|
||||
(into [(str prefix " " (str/join ", " sqls))] params))
|
||||
(let [[sql & params] (format-selectable-dsl xs {:as as})]
|
||||
(into [(str prefix " " sql)] params))))
|
||||
|
|
|
|||
Loading…
Reference in a new issue