Restore - -> _ translation from 1.0
This commit is contained in:
parent
f14b73e592
commit
b547a94003
1 changed files with 12 additions and 10 deletions
|
|
@ -85,16 +85,18 @@
|
||||||
(defn sql-kw [k]
|
(defn sql-kw [k]
|
||||||
(-> k (name) (upper-case) (str/replace "-" " ")))
|
(-> k (name) (upper-case) (str/replace "-" " ")))
|
||||||
|
|
||||||
|
(defn- namespace-_ [x] (some-> (namespace x) (str/replace "-" "_")))
|
||||||
|
(defn- name-_ [x] (str/replace (name x) "-" "_"))
|
||||||
|
|
||||||
(defn- format-entity [x & [{:keys [aliased? drop-ns?]}]]
|
(defn- format-entity [x & [{:keys [aliased? drop-ns?]}]]
|
||||||
(let [q (if (or *quoted* (string? x))
|
(let [nn (if (or *quoted* (string? x)) name name-_)
|
||||||
(:quote *dialect*)
|
q (if (or *quoted* (string? x)) (:quote *dialect*) identity)
|
||||||
identity)
|
|
||||||
[t c] (if-let [n (when-not (or drop-ns? (string? x))
|
[t c] (if-let [n (when-not (or drop-ns? (string? x))
|
||||||
(namespace x))]
|
(namespace-_ x))]
|
||||||
[n (name x)]
|
[n (nn x)]
|
||||||
(if aliased?
|
(if aliased?
|
||||||
[nil (name x)]
|
[nil (nn x)]
|
||||||
(let [[t c] (str/split (name x) #"\.")]
|
(let [[t c] (str/split (nn x) #"\.")]
|
||||||
(if c [t c] [nil t]))))]
|
(if c [t c] [nil t]))))]
|
||||||
(cond->> c
|
(cond->> c
|
||||||
(not= "*" c)
|
(not= "*" c)
|
||||||
|
|
@ -113,7 +115,7 @@
|
||||||
{:params (keys params)})))))}))
|
{:params (keys params)})))))}))
|
||||||
|
|
||||||
(defn- format-var [x & [opts]]
|
(defn- format-var [x & [opts]]
|
||||||
(let [c (name x)]
|
(let [c (name-_ x)]
|
||||||
(cond (= \% (first c))
|
(cond (= \% (first c))
|
||||||
(let [[f & args] (str/split (subs c 1) #"\.")]
|
(let [[f & args] (str/split (subs c 1) #"\.")]
|
||||||
;; TODO: this does not quote arguments -- does that matter?
|
;; TODO: this does not quote arguments -- does that matter?
|
||||||
|
|
@ -464,8 +466,8 @@
|
||||||
(cond
|
(cond
|
||||||
(nil? x) "NULL"
|
(nil? x) "NULL"
|
||||||
(string? x) (str \' (str/replace x "'" "''") \')
|
(string? x) (str \' (str/replace x "'" "''") \')
|
||||||
(symbol? x) (name x)
|
(symbol? x) (name-_ x)
|
||||||
(keyword? x) (name x)
|
(keyword? x) (name-_ x)
|
||||||
:else (str x)))
|
:else (str x)))
|
||||||
|
|
||||||
(def ^:private special-syntax
|
(def ^:private special-syntax
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue