Add missing operators to list and add more error handling.

This commit is contained in:
Alexander K. Hudek 2014-12-23 20:04:11 -05:00
parent 4a06ad489f
commit 5ff1fed578
3 changed files with 13 additions and 6 deletions

View file

@ -1,4 +1,4 @@
(defproject views "0.4.8" (defproject views "0.4.9"
:description "You underestimate the power of the SQL side" :description "You underestimate the power of the SQL side"
:url "https://github.com/diligenceengine/views" :url "https://github.com/diligenceengine/views"

View file

@ -85,10 +85,15 @@
(defn- calculate-delete-deltas (defn- calculate-delete-deltas
[db view-map] [db view-map]
(->> (:delete-deltas-map view-map) (try
hsql/format (->> (:delete-deltas-map view-map)
(j/query db) hsql/format
(assoc view-map :delete-deltas))) (j/query db)
(assoc view-map :delete-deltas))
(catch Exception e
(error "computing delete deltas for" view-map)
(log-exception e)
(throw e))))
(defn compute-delete-deltas-for-insert (defn compute-delete-deltas-for-insert
"Computes and returns a sequence of delete deltas for a single view and insert." "Computes and returns a sequence of delete deltas for a single view and insert."

View file

@ -7,8 +7,10 @@
(def table-clauses (def table-clauses
[:from :insert-into :update :delete-from :join :left-join :right-join]) [:from :insert-into :update :delete-from :join :left-join :right-join])
;; This list doesn't support custom operators. Is there something else we can do?
(def pred-ops (def pred-ops
#{:= :< :> :<> :>= :<= :in :between :match :ltree-match :and :or :not=}) #{:= :< :> :<> :>= :<= :in :between :match :ltree-match :and :or :not= :like :xor :regexp :not-in :not-like
:!= :is :is-not})
(defn process-complex-clause (defn process-complex-clause
[tables clause] [tables clause]