address #471 by switching prefix to :!

This commit is contained in:
Sean Corfield 2023-03-02 09:56:30 -08:00
parent da150f03e3
commit c905853366
2 changed files with 9 additions and 9 deletions

View file

@ -470,7 +470,7 @@
[expr]
(and (ident? expr)
(nil? (namespace expr))
(re-find #"^\*[a-zA-Z]" (name expr))))
(re-find #"^![a-zA-Z]" (name expr))))
(defn format-interspersed-expr-list
"If there are inline (SQL) keywords, use them to join the formatted

View file

@ -1113,23 +1113,23 @@ ORDER BY id = ? DESC
(testing "overlay"
(is (= ["SELECT OVERLAY(foo PLACING ? FROM ? FOR ?)"
"bar" 3 4]
(sut/format {:select [[[:overlay :foo :*placing "bar" :*from 3 :*for 4]]]}))))
(sut/format {:select [[[:overlay :foo :!placing "bar" :!from 3 :!for 4]]]}))))
(testing "position"
(is (= ["SELECT POSITION(? IN bar)" "foo"]
(sut/format {:select [[[:position "foo" :*in :bar]]]}))))
(sut/format {:select [[[:position "foo" :!in :bar]]]}))))
(testing "trim"
(is (= ["SELECT TRIM(LEADING FROM bar)"]
(sut/format {:select [[[:trim :*leading :*from :bar]]]})))
(sut/format {:select [[[:trim :!leading :!from :bar]]]})))
(is (= ["SELECT TRIM(LEADING FROM bar)"]
(sut/format {:select [[[:trim :*leading-from :bar]]]}))))
(sut/format {:select [[[:trim :!leading-from :bar]]]}))))
(testing "extract"
(is (= ["SELECT EXTRACT(CENTURY FROM TIMESTAMP '2000-12-16 12:21:13')"]
(sut/format {:select [[[:extract :*century :*from
:*timestamp [:inline "2000-12-16 12:21:13"]]]]}))))
(sut/format {:select [[[:extract :!century :!from
:!timestamp [:inline "2000-12-16 12:21:13"]]]]}))))
(testing "xmlelement"
(is (= ["SELECT XMLELEMENT(NAME \"foo$bar\", XMLATTRIBUTES('xyz' AS \"a&b\"))"]
(sut/format {:select [[[:xmlelement :*name :foo$bar
[:xmlattributes [:inline "xyz"] :*as :a&b]]]]})))))
(sut/format {:select [[[:xmlelement :!name :foo$bar
[:xmlattributes [:inline "xyz"] :!as :a&b]]]]})))))
(deftest issue-474-dot-selection
(testing "basic dot selection"