From 65d71a25989c1e5e536d6d922f6ea4177cbd91bb Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Thu, 4 Aug 2016 15:36:57 -0700 Subject: [PATCH] Review comment: use :quoting :ansi parameter to honeysql/format. --- src/datomish/db.cljc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/datomish/db.cljc b/src/datomish/db.cljc index dcd6eb00..25241e94 100644 --- a/src/datomish/db.cljc +++ b/src/datomish/db.cljc @@ -35,6 +35,13 @@ (uncaughtException [_ thread ex] (println ex "Uncaught exception on" (.getName thread)))))) +;; Setting this to something else will make your output more readable, +;; but not automatically safe for use. +(def sql-quoting-style :ansi) + +(defn- sql-format [args] + (sql/format args :quoting :ansi)) + (defprotocol IClock (now [clock] @@ -126,7 +133,7 @@ {:select [:e :a :v :tx [1 :added]] ;; TODO: generalize columns. :from [:all_datoms] :where (cons :and (map #(vector := %1 %2) [:e :a :v] (take-while (comp not nil?) [e a v])))} ;; Must drop nils. - (sql/format) + (sql-format) (s/all-rows (:sqlite-connection db)) (> {:select [:ident :entid] :from [:idents]} - (sql/format) + (sql-format) (s/all-rows sqlite-connection)))] (into {} (map (fn [row] [(<-SQLite (:ident row)) (:entid row)])) rows))))) @@ -387,7 +394,7 @@ (->> (->> {:select [:ident :attr :value] :from [:schema]} - (sql/format) + (sql-format) (s/all-rows sqlite-connection)) (